1 /* 2 Copyright (c) 2014, 2021, Oracle and/or its affiliates. 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 23 24 25 #ifndef TABLE_REPLICATION_GROUP_MEMBER_STATS_H 26 #define TABLE_REPLICATION_GROUP_MEMBER_STATS_H 27 28 /** 29 @file storage/perfschema/table_replication_group_member_stats.h 30 Table replication_group_member_stats (declarations). 31 */ 32 33 #include "pfs_column_types.h" 34 #include "pfs_engine_table.h" 35 #include "mysql_com.h" 36 #include "rpl_info.h" 37 #include "rpl_gtid.h" 38 #include <mysql/plugin_group_replication.h> 39 40 /** 41 @addtogroup Performance_schema_tables 42 @{ 43 */ 44 45 /** 46 A row in node status table. The fields with string values have an additional 47 length field denoted by <field_name>_length. 48 */ 49 50 struct st_row_group_member_stats { 51 char channel_name[CHANNEL_NAME_LENGTH]; 52 uint channel_name_length; 53 char view_id[HOSTNAME_LENGTH]; 54 uint view_id_length; 55 char member_id[UUID_LENGTH]; 56 uint member_id_length; 57 ulonglong trx_in_queue; 58 ulonglong trx_checked; 59 ulonglong trx_conflicts; 60 ulonglong trx_rows_validating; 61 char *trx_committed; 62 size_t trx_committed_length; 63 char last_cert_trx[Gtid::MAX_TEXT_LENGTH+1]; 64 int last_cert_trx_length; 65 }; 66 67 /** Table PERFORMANCE_SCHEMA.REPLICATION_GROUP_MEMBER_STATS. */ 68 class table_replication_group_member_stats: public PFS_engine_table 69 { 70 private: 71 void make_row(); 72 /** Table share lock. */ 73 static THR_LOCK m_table_lock; 74 /** Fields definition. */ 75 static TABLE_FIELD_DEF m_field_def; 76 /** True if the current row exists. */ 77 bool m_row_exists; 78 /** Current row */ 79 st_row_group_member_stats m_row; 80 /** Current position. */ 81 PFS_simple_index m_pos; 82 /** Next position. */ 83 PFS_simple_index m_next_pos; 84 85 protected: 86 /** 87 Read the current row values. 88 @param table Table handle 89 @param buf row buffer 90 @param fields Table fields 91 @param read_all true if all columns are read. 92 */ 93 94 virtual int read_row_values(TABLE *table, 95 unsigned char *buf, 96 Field **fields, 97 bool read_all); 98 99 table_replication_group_member_stats(); 100 101 public: 102 ~table_replication_group_member_stats(); 103 104 /** Table share. */ 105 static PFS_engine_table_share m_share; 106 static PFS_engine_table* create(); 107 static ha_rows get_row_count(); 108 virtual int rnd_next(); 109 virtual int rnd_pos(const void *pos); 110 virtual void reset_position(void); 111 112 }; 113 114 /** @} */ 115 #endif 116 117