|
| 1 | +#ifndef WSREP_PS_H |
| 2 | +#define WSREP_PS_H |
| 3 | + |
| 4 | +#include <stdint.h> |
| 5 | +#include <stdbool.h> |
| 6 | +#include "wsrep_api.h" |
| 7 | + |
| 8 | +#ifdef __cplusplus |
| 9 | +extern "C" |
| 10 | +{ |
| 11 | +#endif /* __cplusplus */ |
| 12 | + |
| 13 | +#define WSREP_PS_API_VERSION 0x100 |
| 14 | + |
| 15 | +/*! |
| 16 | + * Structures for communicating information to beexposed through |
| 17 | + * Performance Schema tables: |
| 18 | + */ |
| 19 | + |
| 20 | +#define WSREP_HOSTNAME_LENGTH 64 |
| 21 | +#define WSREP_STATUS_LENGTH 32 |
| 22 | + |
| 23 | +/* Information about the current state of all nodes in the cluster: */ |
| 24 | + |
| 25 | +typedef struct { |
| 26 | + /* Local node index: */ |
| 27 | + uint32_t wsrep_local_index; |
| 28 | + |
| 29 | + /* Unique node ID (UUID): */ |
| 30 | + char wsrep_node_id[WSREP_UUID_STR_LEN + 1]; |
| 31 | + |
| 32 | + /* User-assigned host name: */ |
| 33 | + char wsrep_host_name[WSREP_HOSTNAME_LENGTH + 1]; |
| 34 | + |
| 35 | + /* The UUID of the cluster: */ |
| 36 | + char wsrep_cluster_state_uuid[WSREP_UUID_STR_LEN + 1]; |
| 37 | + |
| 38 | + /* The UUID of the state stored on this node: */ |
| 39 | + char wsrep_local_state_uuid[WSREP_UUID_STR_LEN + 1]; |
| 40 | + |
| 41 | + /* Status PRIMARY/NON_PRIMARY: */ |
| 42 | + char wsrep_status[WSREP_STATUS_LENGTH + 1]; |
| 43 | + |
| 44 | + /* Segment of the node: */ |
| 45 | + uint32_t wsrep_segment; |
| 46 | + |
| 47 | + /* Sequence number of the last applied transaction: */ |
| 48 | + uint64_t wsrep_last_applied; |
| 49 | + |
| 50 | + /* Sequence number of the last committed transaction: */ |
| 51 | + uint64_t wsrep_last_committed; |
| 52 | + |
| 53 | + /* Total number of write-sets replicated: */ |
| 54 | + uint64_t wsrep_replicated; |
| 55 | + |
| 56 | + /* Total size of write-sets replicated: */ |
| 57 | + uint64_t wsrep_replicated_bytes; |
| 58 | + |
| 59 | + /* Total number of write-sets received: */ |
| 60 | + uint64_t wsrep_received; |
| 61 | + |
| 62 | + /* Total size of write-sets received: */ |
| 63 | + uint64_t wsrep_received_bytes; |
| 64 | + |
| 65 | + /* Total number of local transactions that were aborted by slave |
| 66 | + transactions while in execution: */ |
| 67 | + uint64_t wsrep_local_bf_aborts; |
| 68 | + |
| 69 | + /* Total number of local transactions committed: */ |
| 70 | + uint64_t wsrep_local_commits; |
| 71 | + |
| 72 | + /* Total number of local transactions that failed certification test: */ |
| 73 | + uint64_t wsrep_local_cert_failures; |
| 74 | + |
| 75 | + /* Average distance between the highest and lowest concurrently |
| 76 | + applied seqno: */ |
| 77 | + uint64_t wsrep_apply_window; |
| 78 | + |
| 79 | + /* Average distance between the highest and lowest concurrently |
| 80 | + committed seqno: */ |
| 81 | + uint64_t wsrep_commit_window; |
| 82 | +} wsrep_node_info_t; |
| 83 | + |
| 84 | +/*! Data structure with statistics of the current node: */ |
| 85 | + |
| 86 | +typedef struct { |
| 87 | + /* Local node index: */ |
| 88 | + int wsrep_local_index; |
| 89 | + |
| 90 | + /* Unique node ID (UUID): */ |
| 91 | + char wsrep_node_id[WSREP_UUID_STR_LEN + 1]; |
| 92 | + |
| 93 | + /* Total number of keys replicated: */ |
| 94 | + uint64_t wsrep_repl_keys; |
| 95 | + |
| 96 | + /* Total size of keys replicated: */ |
| 97 | + uint64_t wsrep_repl_keys_bytes; |
| 98 | + |
| 99 | + /* Total size of data replicated: */ |
| 100 | + uint64_t wsrep_repl_data_bytes; |
| 101 | + |
| 102 | + /* Total size of other bits replicated: */ |
| 103 | + uint64_t wsrep_repl_other_bytes; |
| 104 | + |
| 105 | + /* Total number of transaction replays due to asymmetric lock |
| 106 | + granularity: */ |
| 107 | + uint64_t wsrep_local_replays; |
| 108 | + |
| 109 | + /* Current (instantaneous) length of the send queue: */ |
| 110 | + uint64_t wsrep_local_send_queue; |
| 111 | + |
| 112 | + /* Send queue length averaged over time since the last |
| 113 | + FLUSH STATUS command: */ |
| 114 | + double wsrep_local_send_queue_avg; |
| 115 | + |
| 116 | + /* Current (instantaneous) length of the recv queue: */ |
| 117 | + uint64_t wsrep_local_recv_queue; |
| 118 | + |
| 119 | + /* Recv queue length averaged over interval since the last |
| 120 | + FLUSH STATUS command: */ |
| 121 | + double wsrep_local_recv_queue_avg; |
| 122 | + |
| 123 | + /* The fraction of time (out of 1.0) since the last |
| 124 | + SHOW GLOBAL STATUS that flow control is effective: */ |
| 125 | + uint64_t wsrep_flow_control_paused; |
| 126 | + |
| 127 | + /* The number of flow control messages sent by the local node |
| 128 | + to the cluster: */ |
| 129 | + uint64_t wsrep_flow_control_sent; |
| 130 | + |
| 131 | + /* The number of flow control messages the node has received, |
| 132 | + including those the node has sent: */ |
| 133 | + uint64_t wsrep_flow_control_recv; |
| 134 | + |
| 135 | + /* This variable shows whether a node has flow control |
| 136 | + enabled for normal traffic: */ |
| 137 | + char wsrep_flow_control_status[WSREP_STATUS_LENGTH + 1]; |
| 138 | + |
| 139 | + /* Average distance between the highest and lowest seqno |
| 140 | + value that can be possibly applied in parallel: */ |
| 141 | + double wsrep_cert_deps_distance; |
| 142 | + |
| 143 | + /* The number of locally running transactions which have been |
| 144 | + registered inside the wsrep provider: */ |
| 145 | + uint64_t wsrep_open_transactions; |
| 146 | + |
| 147 | + /* This status variable provides figures for the replication |
| 148 | + latency on group communication: */ |
| 149 | + uint64_t wsrep_evs_repl_latency; |
| 150 | +} wsrep_node_stat_t; |
| 151 | + |
| 152 | +/*! |
| 153 | + * @brief Get general cluster information to expose through |
| 154 | + * Performance Schema. |
| 155 | + * |
| 156 | + * @param wsrep provider handle. |
| 157 | + * @param nodes array of node information to populate. |
| 158 | + * @param size size of array (in/out parameter). |
| 159 | + */ |
| 160 | +typedef wsrep_status_t |
| 161 | + (*wsrep_ps_fetch_cluster_info_t) (wsrep_t* wsrep, |
| 162 | + wsrep_node_info_t* nodes, |
| 163 | + uint32_t* size); |
| 164 | + |
| 165 | +/*! |
| 166 | + * @brief Get current node information to expose through |
| 167 | + * Performance Schema. |
| 168 | + * |
| 169 | + * @param wsrep provider handle. |
| 170 | + * @param node data structure with information about the node |
| 171 | + * (will be filled with data, output parameter). |
| 172 | + */ |
| 173 | +typedef wsrep_status_t |
| 174 | + (*wsrep_ps_fetch_node_stat_t) (wsrep_t* wsrep, |
| 175 | + wsrep_node_stat_t* node); |
| 176 | + |
| 177 | +typedef struct wsrep_ps_service_v1_st |
| 178 | +{ |
| 179 | + wsrep_ps_fetch_cluster_info_t fetch_cluster_info; |
| 180 | + wsrep_ps_fetch_node_stat_t fetch_node_stat; |
| 181 | +} wsrep_ps_service_v1_t; |
| 182 | + |
| 183 | +#define WSREP_PS_SERVICE_INIT_FUNC_V1 "wsrep_init_ps_service_v1" |
| 184 | +#define WSREP_PS_SERVICE_DEINIT_FUNC_V1 "wsrep_deinit_ps_service_v1" |
| 185 | + |
| 186 | +/* For backwards compatibility. */ |
| 187 | +#define WSREP_PS_SERVICE_INIT_FUNC WSREP_PS_SERVICE_INIT_FUNC_V1 |
| 188 | + |
| 189 | +#ifdef __cplusplus |
| 190 | +} |
| 191 | +#endif /* __cplusplus */ |
| 192 | + |
| 193 | +#endif /* WSREP_PS_H */ |
0 commit comments