1 /* 2 Copyright (c) 2013, 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_APPLIER_STATUS_BY_COORDINATOR_H 26 #define TABLE_REPLICATION_APPLIER_STATUS_BY_COORDINATOR_H 27 28 /** 29 @file storage/perfschema/table_replication_applier_applier_by_coordinator.h 30 Table replication_applier_status_by_coordinator(declarations). 31 */ 32 33 #include "pfs_column_types.h" 34 #include "pfs_engine_table.h" 35 #include "rpl_mi.h" 36 #include "mysql_com.h" 37 #include "rpl_msr.h" 38 #include "rpl_info.h" /*CHANNEL_NAME_LENGTH*/ 39 40 class Master_info; 41 42 /** 43 @addtogroup Performance_schema_tables 44 @{ 45 */ 46 47 #ifndef ENUM_RPL_YES_NO 48 #define ENUM_RPL_YES_NO 49 /** enum values for Service_State of coordinator thread */ 50 enum enum_rpl_yes_no { 51 PS_RPL_YES= 1, /* Service_State= on */ 52 PS_RPL_NO /* Service_State= off */ 53 }; 54 #endif 55 56 /* 57 A row in coordinator's table. The fields with string values have an 58 additional length field denoted by <field_name>_length. 59 */ 60 struct st_row_coordinator { 61 char channel_name[CHANNEL_NAME_LENGTH]; 62 uint channel_name_length; 63 ulonglong thread_id; 64 bool thread_id_is_null; 65 enum_rpl_yes_no service_state; 66 uint last_error_number; 67 char last_error_message[MAX_SLAVE_ERRMSG]; 68 uint last_error_message_length; 69 ulonglong last_error_timestamp; 70 }; 71 72 /** Table PERFORMANCE_SCHEMA.replication_applier_status_by_coordinator */ 73 class table_replication_applier_status_by_coordinator: public PFS_engine_table 74 { 75 typedef PFS_simple_index pos_t; 76 77 private: 78 void make_row(Master_info *mi); 79 80 /** Table share lock. */ 81 static THR_LOCK m_table_lock; 82 /** Fields definition. */ 83 static TABLE_FIELD_DEF m_field_def; 84 /** Current row */ 85 st_row_coordinator m_row; 86 /** True is the current row exists. */ 87 bool m_row_exists; 88 /** Current position. */ 89 pos_t m_pos; 90 /** Next position. */ 91 pos_t m_next_pos; 92 93 protected: 94 /** 95 Read the current row values. 96 @param table Table handle 97 @param buf row buffer 98 @param fields Table fields 99 @param read_all true if all columns are read. 100 */ 101 102 virtual int read_row_values(TABLE *table, 103 unsigned char *buf, 104 Field **fields, 105 bool read_all); 106 107 table_replication_applier_status_by_coordinator(); 108 109 public: 110 ~table_replication_applier_status_by_coordinator(); 111 112 /** Table share. */ 113 static PFS_engine_table_share m_share; 114 static PFS_engine_table* create(); 115 static ha_rows get_row_count(); 116 virtual int rnd_next(); 117 virtual int rnd_pos(const void *pos); 118 virtual void reset_position(void); 119 120 }; 121 122 /** @} */ 123 #endif 124