| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2012, Facebook Inc. |
| 5 | Copyright (c) 2013, 2018, MariaDB Corporation. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify it under |
| 8 | the terms of the GNU General Public License as published by the Free Software |
| 9 | Foundation; version 2 of the License. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 13 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License along with |
| 16 | this program; if not, write to the Free Software Foundation, Inc., |
| 17 | 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA |
| 18 | |
| 19 | *****************************************************************************/ |
| 20 | |
| 21 | /**************************************************//** |
| 22 | @file srv/srv0mon.cc |
| 23 | Database monitor counter interfaces |
| 24 | |
| 25 | Created 12/9/2009 Jimmy Yang |
| 26 | *******************************************************/ |
| 27 | |
| 28 | #include "buf0buf.h" |
| 29 | #include "dict0mem.h" |
| 30 | #include "ibuf0ibuf.h" |
| 31 | #include "lock0lock.h" |
| 32 | #include "mach0data.h" |
| 33 | #include "os0file.h" |
| 34 | #include "srv0mon.h" |
| 35 | #include "srv0srv.h" |
| 36 | #include "trx0rseg.h" |
| 37 | #include "trx0sys.h" |
| 38 | |
| 39 | /* Macro to standardize the counter names for counters in the |
| 40 | "monitor_buf_page" module as they have very structured defines */ |
| 41 | #define MONITOR_BUF_PAGE(name, description, code, op, op_code) \ |
| 42 | {"buffer_page_" op "_" name, "buffer_page_io", \ |
| 43 | "Number of " description " Pages " op, \ |
| 44 | MONITOR_GROUP_MODULE, MONITOR_DEFAULT_START, \ |
| 45 | MONITOR_##code##_##op_code} |
| 46 | |
| 47 | #define MONITOR_BUF_PAGE_READ(name, description, code) \ |
| 48 | MONITOR_BUF_PAGE(name, description, code, "read", PAGE_READ) |
| 49 | |
| 50 | #define MONITOR_BUF_PAGE_WRITTEN(name, description, code) \ |
| 51 | MONITOR_BUF_PAGE(name, description, code, "written", PAGE_WRITTEN) |
| 52 | |
| 53 | /** This array defines basic static information of monitor counters, |
| 54 | including each monitor's name, module it belongs to, a short |
| 55 | description and its property/type and corresponding monitor_id. |
| 56 | Please note: If you add a monitor here, please add its corresponding |
| 57 | monitor_id to "enum monitor_id_value" structure in srv0mon.h file. */ |
| 58 | |
| 59 | static monitor_info_t innodb_counter_info[] = |
| 60 | { |
| 61 | /* A dummy item to mark the module start, this is |
| 62 | to accomodate the default value (0) set for the |
| 63 | global variables with the control system. */ |
| 64 | {"module_start" , "module_start" , "module_start" , |
| 65 | MONITOR_MODULE, |
| 66 | MONITOR_DEFAULT_START, MONITOR_DEFAULT_START}, |
| 67 | |
| 68 | /* ========== Counters for Server Metadata ========== */ |
| 69 | {"module_metadata" , "metadata" , "Server Metadata" , |
| 70 | MONITOR_MODULE, |
| 71 | MONITOR_DEFAULT_START, MONITOR_MODULE_METADATA}, |
| 72 | |
| 73 | {"metadata_table_handles_opened" , "metadata" , |
| 74 | "Number of table handles opened" , |
| 75 | MONITOR_NONE, |
| 76 | MONITOR_DEFAULT_START, MONITOR_TABLE_OPEN}, |
| 77 | |
| 78 | {"metadata_table_handles_closed" , "metadata" , |
| 79 | "Number of table handles closed" , |
| 80 | MONITOR_NONE, |
| 81 | MONITOR_DEFAULT_START, MONITOR_TABLE_CLOSE}, |
| 82 | |
| 83 | {"metadata_table_reference_count" , "metadata" , |
| 84 | "Table reference counter" , |
| 85 | MONITOR_NONE, |
| 86 | MONITOR_DEFAULT_START, MONITOR_TABLE_REFERENCE}, |
| 87 | |
| 88 | /* ========== Counters for Lock Module ========== */ |
| 89 | {"module_lock" , "lock" , "Lock Module" , |
| 90 | MONITOR_MODULE, |
| 91 | MONITOR_DEFAULT_START, MONITOR_MODULE_LOCK}, |
| 92 | |
| 93 | {"lock_deadlocks" , "lock" , "Number of deadlocks" , |
| 94 | MONITOR_DEFAULT_ON, |
| 95 | MONITOR_DEFAULT_START, MONITOR_DEADLOCK}, |
| 96 | |
| 97 | {"lock_timeouts" , "lock" , "Number of lock timeouts" , |
| 98 | MONITOR_DEFAULT_ON, |
| 99 | MONITOR_DEFAULT_START, MONITOR_TIMEOUT}, |
| 100 | |
| 101 | {"lock_rec_lock_waits" , "lock" , |
| 102 | "Number of times enqueued into record lock wait queue" , |
| 103 | MONITOR_NONE, |
| 104 | MONITOR_DEFAULT_START, MONITOR_LOCKREC_WAIT}, |
| 105 | |
| 106 | {"lock_table_lock_waits" , "lock" , |
| 107 | "Number of times enqueued into table lock wait queue" , |
| 108 | MONITOR_NONE, |
| 109 | MONITOR_DEFAULT_START, MONITOR_TABLELOCK_WAIT}, |
| 110 | |
| 111 | {"lock_rec_lock_requests" , "lock" , |
| 112 | "Number of record locks requested" , |
| 113 | MONITOR_NONE, |
| 114 | MONITOR_DEFAULT_START, MONITOR_NUM_RECLOCK_REQ}, |
| 115 | |
| 116 | {"lock_rec_lock_created" , "lock" , "Number of record locks created" , |
| 117 | MONITOR_NONE, |
| 118 | MONITOR_DEFAULT_START, MONITOR_RECLOCK_CREATED}, |
| 119 | |
| 120 | {"lock_rec_lock_removed" , "lock" , |
| 121 | "Number of record locks removed from the lock queue" , |
| 122 | MONITOR_NONE, |
| 123 | MONITOR_DEFAULT_START, MONITOR_RECLOCK_REMOVED}, |
| 124 | |
| 125 | {"lock_rec_locks" , "lock" , |
| 126 | "Current number of record locks on tables" , |
| 127 | MONITOR_NONE, |
| 128 | MONITOR_DEFAULT_START, MONITOR_NUM_RECLOCK}, |
| 129 | |
| 130 | {"lock_table_lock_created" , "lock" , "Number of table locks created" , |
| 131 | MONITOR_NONE, |
| 132 | MONITOR_DEFAULT_START, MONITOR_TABLELOCK_CREATED}, |
| 133 | |
| 134 | {"lock_table_lock_removed" , "lock" , |
| 135 | "Number of table locks removed from the lock queue" , |
| 136 | MONITOR_NONE, |
| 137 | MONITOR_DEFAULT_START, MONITOR_TABLELOCK_REMOVED}, |
| 138 | |
| 139 | {"lock_table_locks" , "lock" , |
| 140 | "Current number of table locks on tables" , |
| 141 | MONITOR_NONE, |
| 142 | MONITOR_DEFAULT_START, MONITOR_NUM_TABLELOCK}, |
| 143 | |
| 144 | {"lock_row_lock_current_waits" , "lock" , |
| 145 | "Number of row locks currently being waited for" |
| 146 | " (innodb_row_lock_current_waits)" , |
| 147 | static_cast<monitor_type_t>( |
| 148 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 149 | MONITOR_DEFAULT_START, MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT}, |
| 150 | |
| 151 | {"lock_row_lock_time" , "lock" , |
| 152 | "Time spent in acquiring row locks, in milliseconds" |
| 153 | " (innodb_row_lock_time)" , |
| 154 | static_cast<monitor_type_t>( |
| 155 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 156 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_WAIT_TIME}, |
| 157 | |
| 158 | {"lock_row_lock_time_max" , "lock" , |
| 159 | "The maximum time to acquire a row lock, in milliseconds" |
| 160 | " (innodb_row_lock_time_max)" , |
| 161 | static_cast<monitor_type_t>( |
| 162 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 163 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_MAX_WAIT_TIME}, |
| 164 | |
| 165 | {"lock_row_lock_waits" , "lock" , |
| 166 | "Number of times a row lock had to be waited for" |
| 167 | " (innodb_row_lock_waits)" , |
| 168 | static_cast<monitor_type_t>( |
| 169 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 170 | MONITOR_DEFAULT_START, MONITOR_OVLD_ROW_LOCK_WAIT}, |
| 171 | |
| 172 | {"lock_row_lock_time_avg" , "lock" , |
| 173 | "The average time to acquire a row lock, in milliseconds" |
| 174 | " (innodb_row_lock_time_avg)" , |
| 175 | static_cast<monitor_type_t>( |
| 176 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 177 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOCK_AVG_WAIT_TIME}, |
| 178 | |
| 179 | /* ========== Counters for Buffer Manager and I/O ========== */ |
| 180 | {"module_buffer" , "buffer" , "Buffer Manager Module" , |
| 181 | MONITOR_MODULE, |
| 182 | MONITOR_DEFAULT_START, MONITOR_MODULE_BUFFER}, |
| 183 | |
| 184 | {"buffer_pool_size" , "server" , |
| 185 | "Server buffer pool size (all buffer pools) in bytes" , |
| 186 | static_cast<monitor_type_t>( |
| 187 | MONITOR_EXISTING | MONITOR_DEFAULT_ON | MONITOR_DISPLAY_CURRENT), |
| 188 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUFFER_POOL_SIZE}, |
| 189 | |
| 190 | {"buffer_pool_reads" , "buffer" , |
| 191 | "Number of reads directly from disk (innodb_buffer_pool_reads)" , |
| 192 | static_cast<monitor_type_t>( |
| 193 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 194 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READS}, |
| 195 | |
| 196 | {"buffer_pool_read_requests" , "buffer" , |
| 197 | "Number of logical read requests (innodb_buffer_pool_read_requests)" , |
| 198 | static_cast<monitor_type_t>( |
| 199 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 200 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_REQUESTS}, |
| 201 | |
| 202 | {"buffer_pool_write_requests" , "buffer" , |
| 203 | "Number of write requests (innodb_buffer_pool_write_requests)" , |
| 204 | static_cast<monitor_type_t>( |
| 205 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 206 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_WRITE_REQUEST}, |
| 207 | |
| 208 | {"buffer_pool_wait_free" , "buffer" , |
| 209 | "Number of times waited for free buffer" |
| 210 | " (innodb_buffer_pool_wait_free)" , |
| 211 | static_cast<monitor_type_t>( |
| 212 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 213 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_WAIT_FREE}, |
| 214 | |
| 215 | {"buffer_pool_read_ahead" , "buffer" , |
| 216 | "Number of pages read as read ahead (innodb_buffer_pool_read_ahead)" , |
| 217 | static_cast<monitor_type_t>( |
| 218 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 219 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_AHEAD}, |
| 220 | |
| 221 | {"buffer_pool_read_ahead_evicted" , "buffer" , |
| 222 | "Read-ahead pages evicted without being accessed" |
| 223 | " (innodb_buffer_pool_read_ahead_evicted)" , |
| 224 | static_cast<monitor_type_t>( |
| 225 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 226 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED}, |
| 227 | |
| 228 | {"buffer_pool_pages_total" , "buffer" , |
| 229 | "Total buffer pool size in pages (innodb_buffer_pool_pages_total)" , |
| 230 | static_cast<monitor_type_t>( |
| 231 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 232 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGE_TOTAL}, |
| 233 | |
| 234 | {"buffer_pool_pages_misc" , "buffer" , |
| 235 | "Buffer pages for misc use such as row locks or the adaptive" |
| 236 | " hash index (innodb_buffer_pool_pages_misc)" , |
| 237 | static_cast<monitor_type_t>( |
| 238 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 239 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGE_MISC}, |
| 240 | |
| 241 | {"buffer_pool_pages_data" , "buffer" , |
| 242 | "Buffer pages containing data (innodb_buffer_pool_pages_data)" , |
| 243 | static_cast<monitor_type_t>( |
| 244 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 245 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DATA}, |
| 246 | |
| 247 | {"buffer_pool_bytes_data" , "buffer" , |
| 248 | "Buffer bytes containing data (innodb_buffer_pool_bytes_data)" , |
| 249 | static_cast<monitor_type_t>( |
| 250 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 251 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DATA}, |
| 252 | |
| 253 | {"buffer_pool_pages_dirty" , "buffer" , |
| 254 | "Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)" , |
| 255 | static_cast<monitor_type_t>( |
| 256 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 257 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DIRTY}, |
| 258 | |
| 259 | {"buffer_pool_bytes_dirty" , "buffer" , |
| 260 | "Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)" , |
| 261 | static_cast<monitor_type_t>( |
| 262 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 263 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DIRTY}, |
| 264 | |
| 265 | {"buffer_pool_pages_free" , "buffer" , |
| 266 | "Buffer pages currently free (innodb_buffer_pool_pages_free)" , |
| 267 | static_cast<monitor_type_t>( |
| 268 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 269 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_FREE}, |
| 270 | |
| 271 | {"buffer_pages_created" , "buffer" , |
| 272 | "Number of pages created (innodb_pages_created)" , |
| 273 | static_cast<monitor_type_t>( |
| 274 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 275 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_CREATED}, |
| 276 | |
| 277 | {"buffer_pages_written" , "buffer" , |
| 278 | "Number of pages written (innodb_pages_written)" , |
| 279 | static_cast<monitor_type_t>( |
| 280 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 281 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_WRITTEN}, |
| 282 | |
| 283 | {"buffer_index_pages_written" , "buffer" , |
| 284 | "Number of index pages written (innodb_index_pages_written)" , |
| 285 | static_cast<monitor_type_t>( |
| 286 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 287 | MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_PAGES_WRITTEN}, |
| 288 | |
| 289 | {"buffer_non_index_pages_written" , "buffer" , |
| 290 | "Number of non index pages written (innodb_non_index_pages_written)" , |
| 291 | static_cast<monitor_type_t>( |
| 292 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 293 | MONITOR_DEFAULT_START, MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN}, |
| 294 | |
| 295 | {"buffer_pages_read" , "buffer" , |
| 296 | "Number of pages read (innodb_pages_read)" , |
| 297 | static_cast<monitor_type_t>( |
| 298 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 299 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_READ}, |
| 300 | |
| 301 | {"buffer_pages0_read" , "buffer" , |
| 302 | "Number of page 0 read (innodb_pages0_read)" , |
| 303 | static_cast<monitor_type_t>( |
| 304 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 305 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES0_READ}, |
| 306 | |
| 307 | {"buffer_index_sec_rec_cluster_reads" , "buffer" , |
| 308 | "Number of secondary record reads triggered cluster read" , |
| 309 | static_cast<monitor_type_t>( |
| 310 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 311 | MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS}, |
| 312 | |
| 313 | {"buffer_index_sec_rec_cluster_reads_avoided" , "buffer" , |
| 314 | "Number of secondary record reads avoided triggering cluster read" , |
| 315 | static_cast<monitor_type_t>( |
| 316 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 317 | MONITOR_DEFAULT_START, MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED}, |
| 318 | |
| 319 | {"buffer_data_reads" , "buffer" , |
| 320 | "Amount of data read in bytes (innodb_data_reads)" , |
| 321 | static_cast<monitor_type_t>( |
| 322 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 323 | MONITOR_DEFAULT_START, MONITOR_OVLD_BYTE_READ}, |
| 324 | |
| 325 | {"buffer_data_written" , "buffer" , |
| 326 | "Amount of data written in bytes (innodb_data_written)" , |
| 327 | static_cast<monitor_type_t>( |
| 328 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 329 | MONITOR_DEFAULT_START, MONITOR_OVLD_BYTE_WRITTEN}, |
| 330 | |
| 331 | /* Cumulative counter for scanning in flush batches */ |
| 332 | {"buffer_flush_batch_scanned" , "buffer" , |
| 333 | "Total pages scanned as part of flush batch" , |
| 334 | MONITOR_SET_OWNER, |
| 335 | MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL, |
| 336 | MONITOR_FLUSH_BATCH_SCANNED}, |
| 337 | |
| 338 | {"buffer_flush_batch_num_scan" , "buffer" , |
| 339 | "Number of times buffer flush list flush is called" , |
| 340 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_SCANNED, |
| 341 | MONITOR_FLUSH_BATCH_SCANNED_NUM_CALL}, |
| 342 | |
| 343 | {"buffer_flush_batch_scanned_per_call" , "buffer" , |
| 344 | "Pages scanned per flush batch scan" , |
| 345 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_SCANNED, |
| 346 | MONITOR_FLUSH_BATCH_SCANNED_PER_CALL}, |
| 347 | |
| 348 | /* Cumulative counter for pages flushed in flush batches */ |
| 349 | {"buffer_flush_batch_total_pages" , "buffer" , |
| 350 | "Total pages flushed as part of flush batch" , |
| 351 | MONITOR_SET_OWNER, MONITOR_FLUSH_BATCH_COUNT, |
| 352 | MONITOR_FLUSH_BATCH_TOTAL_PAGE}, |
| 353 | |
| 354 | {"buffer_flush_batches" , "buffer" , |
| 355 | "Number of flush batches" , |
| 356 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_TOTAL_PAGE, |
| 357 | MONITOR_FLUSH_BATCH_COUNT}, |
| 358 | |
| 359 | {"buffer_flush_batch_pages" , "buffer" , |
| 360 | "Pages queued as a flush batch" , |
| 361 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BATCH_TOTAL_PAGE, |
| 362 | MONITOR_FLUSH_BATCH_PAGES}, |
| 363 | |
| 364 | /* Cumulative counter for flush batches because of neighbor */ |
| 365 | {"buffer_flush_neighbor_total_pages" , "buffer" , |
| 366 | "Total neighbors flushed as part of neighbor flush" , |
| 367 | MONITOR_SET_OWNER, MONITOR_FLUSH_NEIGHBOR_COUNT, |
| 368 | MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE}, |
| 369 | |
| 370 | {"buffer_flush_neighbor" , "buffer" , |
| 371 | "Number of times neighbors flushing is invoked" , |
| 372 | MONITOR_SET_MEMBER, MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE, |
| 373 | MONITOR_FLUSH_NEIGHBOR_COUNT}, |
| 374 | |
| 375 | {"buffer_flush_neighbor_pages" , "buffer" , |
| 376 | "Pages queued as a neighbor batch" , |
| 377 | MONITOR_SET_MEMBER, MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE, |
| 378 | MONITOR_FLUSH_NEIGHBOR_PAGES}, |
| 379 | |
| 380 | {"buffer_flush_n_to_flush_requested" , "buffer" , |
| 381 | "Number of pages requested for flushing." , |
| 382 | MONITOR_NONE, |
| 383 | MONITOR_DEFAULT_START, MONITOR_FLUSH_N_TO_FLUSH_REQUESTED}, |
| 384 | |
| 385 | {"buffer_flush_n_to_flush_by_age" , "buffer" , |
| 386 | "Number of pages target by LSN Age for flushing." , |
| 387 | MONITOR_NONE, |
| 388 | MONITOR_DEFAULT_START, MONITOR_FLUSH_N_TO_FLUSH_BY_AGE}, |
| 389 | |
| 390 | {"buffer_flush_adaptive_avg_time_slot" , "buffer" , |
| 391 | "Avg time (ms) spent for adaptive flushing recently per slot." , |
| 392 | MONITOR_NONE, |
| 393 | MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_SLOT}, |
| 394 | |
| 395 | {"buffer_LRU_batch_flush_avg_time_slot" , "buffer" , |
| 396 | "Avg time (ms) spent for LRU batch flushing recently per slot." , |
| 397 | MONITOR_NONE, |
| 398 | MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_SLOT}, |
| 399 | |
| 400 | {"buffer_flush_adaptive_avg_time_thread" , "buffer" , |
| 401 | "Avg time (ms) spent for adaptive flushing recently per thread." , |
| 402 | MONITOR_NONE, |
| 403 | MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_THREAD}, |
| 404 | |
| 405 | {"buffer_LRU_batch_flush_avg_time_thread" , "buffer" , |
| 406 | "Avg time (ms) spent for LRU batch flushing recently per thread." , |
| 407 | MONITOR_NONE, |
| 408 | MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_THREAD}, |
| 409 | |
| 410 | {"buffer_flush_adaptive_avg_time_est" , "buffer" , |
| 411 | "Estimated time (ms) spent for adaptive flushing recently." , |
| 412 | MONITOR_NONE, |
| 413 | MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_TIME_EST}, |
| 414 | |
| 415 | {"buffer_LRU_batch_flush_avg_time_est" , "buffer" , |
| 416 | "Estimated time (ms) spent for LRU batch flushing recently." , |
| 417 | MONITOR_NONE, |
| 418 | MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_TIME_EST}, |
| 419 | |
| 420 | {"buffer_flush_avg_time" , "buffer" , |
| 421 | "Avg time (ms) spent for flushing recently." , |
| 422 | MONITOR_NONE, |
| 423 | MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_TIME}, |
| 424 | |
| 425 | {"buffer_flush_adaptive_avg_pass" , "buffer" , |
| 426 | "Numner of adaptive flushes passed during the recent Avg period." , |
| 427 | MONITOR_NONE, |
| 428 | MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_PASS}, |
| 429 | |
| 430 | {"buffer_LRU_batch_flush_avg_pass" , "buffer" , |
| 431 | "Number of LRU batch flushes passed during the recent Avg period." , |
| 432 | MONITOR_NONE, |
| 433 | MONITOR_DEFAULT_START, MONITOR_LRU_BATCH_FLUSH_AVG_PASS}, |
| 434 | |
| 435 | {"buffer_flush_avg_pass" , "buffer" , |
| 436 | "Number of flushes passed during the recent Avg period." , |
| 437 | MONITOR_NONE, |
| 438 | MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_PASS}, |
| 439 | |
| 440 | {"buffer_LRU_get_free_loops" , "buffer" , |
| 441 | "Total loops in LRU get free." , |
| 442 | MONITOR_NONE, |
| 443 | MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_LOOPS}, |
| 444 | |
| 445 | {"buffer_LRU_get_free_waits" , "buffer" , |
| 446 | "Total sleep waits in LRU get free." , |
| 447 | MONITOR_NONE, |
| 448 | MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_WAITS}, |
| 449 | |
| 450 | {"buffer_flush_avg_page_rate" , "buffer" , |
| 451 | "Average number of pages at which flushing is happening" , |
| 452 | MONITOR_NONE, |
| 453 | MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_PAGE_RATE}, |
| 454 | |
| 455 | {"buffer_flush_lsn_avg_rate" , "buffer" , |
| 456 | "Average redo generation rate" , |
| 457 | MONITOR_NONE, |
| 458 | MONITOR_DEFAULT_START, MONITOR_FLUSH_LSN_AVG_RATE}, |
| 459 | |
| 460 | {"buffer_flush_pct_for_dirty" , "buffer" , |
| 461 | "Percent of IO capacity used to avoid max dirty page limit" , |
| 462 | MONITOR_NONE, |
| 463 | MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_DIRTY}, |
| 464 | |
| 465 | {"buffer_flush_pct_for_lsn" , "buffer" , |
| 466 | "Percent of IO capacity used to avoid reusable redo space limit" , |
| 467 | MONITOR_NONE, |
| 468 | MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_LSN}, |
| 469 | |
| 470 | {"buffer_flush_sync_waits" , "buffer" , |
| 471 | "Number of times a wait happens due to sync flushing" , |
| 472 | MONITOR_NONE, |
| 473 | MONITOR_DEFAULT_START, MONITOR_FLUSH_SYNC_WAITS}, |
| 474 | |
| 475 | /* Cumulative counter for flush batches for adaptive flushing */ |
| 476 | {"buffer_flush_adaptive_total_pages" , "buffer" , |
| 477 | "Total pages flushed as part of adaptive flushing" , |
| 478 | MONITOR_SET_OWNER, MONITOR_FLUSH_ADAPTIVE_COUNT, |
| 479 | MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE}, |
| 480 | |
| 481 | {"buffer_flush_adaptive" , "buffer" , |
| 482 | "Number of adaptive batches" , |
| 483 | MONITOR_SET_MEMBER, MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE, |
| 484 | MONITOR_FLUSH_ADAPTIVE_COUNT}, |
| 485 | |
| 486 | {"buffer_flush_adaptive_pages" , "buffer" , |
| 487 | "Pages queued as an adaptive batch" , |
| 488 | MONITOR_SET_MEMBER, MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE, |
| 489 | MONITOR_FLUSH_ADAPTIVE_PAGES}, |
| 490 | |
| 491 | /* Cumulative counter for flush batches because of sync */ |
| 492 | {"buffer_flush_sync_total_pages" , "buffer" , |
| 493 | "Total pages flushed as part of sync batches" , |
| 494 | MONITOR_SET_OWNER, MONITOR_FLUSH_SYNC_COUNT, |
| 495 | MONITOR_FLUSH_SYNC_TOTAL_PAGE}, |
| 496 | |
| 497 | {"buffer_flush_sync" , "buffer" , |
| 498 | "Number of sync batches" , |
| 499 | MONITOR_SET_MEMBER, MONITOR_FLUSH_SYNC_TOTAL_PAGE, |
| 500 | MONITOR_FLUSH_SYNC_COUNT}, |
| 501 | |
| 502 | {"buffer_flush_sync_pages" , "buffer" , |
| 503 | "Pages queued as a sync batch" , |
| 504 | MONITOR_SET_MEMBER, MONITOR_FLUSH_SYNC_TOTAL_PAGE, |
| 505 | MONITOR_FLUSH_SYNC_PAGES}, |
| 506 | |
| 507 | /* Cumulative counter for flush batches because of background */ |
| 508 | {"buffer_flush_background_total_pages" , "buffer" , |
| 509 | "Total pages flushed as part of background batches" , |
| 510 | MONITOR_SET_OWNER, MONITOR_FLUSH_BACKGROUND_COUNT, |
| 511 | MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE}, |
| 512 | |
| 513 | {"buffer_flush_background" , "buffer" , |
| 514 | "Number of background batches" , |
| 515 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE, |
| 516 | MONITOR_FLUSH_BACKGROUND_COUNT}, |
| 517 | |
| 518 | {"buffer_flush_background_pages" , "buffer" , |
| 519 | "Pages queued as a background batch" , |
| 520 | MONITOR_SET_MEMBER, MONITOR_FLUSH_BACKGROUND_TOTAL_PAGE, |
| 521 | MONITOR_FLUSH_BACKGROUND_PAGES}, |
| 522 | |
| 523 | /* Cumulative counter for LRU batch scan */ |
| 524 | {"buffer_LRU_batch_scanned" , "buffer" , |
| 525 | "Total pages scanned as part of LRU batch" , |
| 526 | MONITOR_SET_OWNER, MONITOR_LRU_BATCH_SCANNED_NUM_CALL, |
| 527 | MONITOR_LRU_BATCH_SCANNED}, |
| 528 | |
| 529 | {"buffer_LRU_batch_num_scan" , "buffer" , |
| 530 | "Number of times LRU batch is called" , |
| 531 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_SCANNED, |
| 532 | MONITOR_LRU_BATCH_SCANNED_NUM_CALL}, |
| 533 | |
| 534 | {"buffer_LRU_batch_scanned_per_call" , "buffer" , |
| 535 | "Pages scanned per LRU batch call" , |
| 536 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_SCANNED, |
| 537 | MONITOR_LRU_BATCH_SCANNED_PER_CALL}, |
| 538 | |
| 539 | /* Cumulative counter for LRU batch pages flushed */ |
| 540 | {"buffer_LRU_batch_flush_total_pages" , "buffer" , |
| 541 | "Total pages flushed as part of LRU batches" , |
| 542 | MONITOR_SET_OWNER, MONITOR_LRU_BATCH_FLUSH_COUNT, |
| 543 | MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE}, |
| 544 | |
| 545 | {"buffer_LRU_batches_flush" , "buffer" , |
| 546 | "Number of LRU batches" , |
| 547 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE, |
| 548 | MONITOR_LRU_BATCH_FLUSH_COUNT}, |
| 549 | |
| 550 | {"buffer_LRU_batch_flush_pages" , "buffer" , |
| 551 | "Pages queued as an LRU batch" , |
| 552 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_FLUSH_TOTAL_PAGE, |
| 553 | MONITOR_LRU_BATCH_FLUSH_PAGES}, |
| 554 | |
| 555 | /* Cumulative counter for LRU batch pages flushed */ |
| 556 | {"buffer_LRU_batch_evict_total_pages" , "buffer" , |
| 557 | "Total pages evicted as part of LRU batches" , |
| 558 | MONITOR_SET_OWNER, MONITOR_LRU_BATCH_EVICT_COUNT, |
| 559 | MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE}, |
| 560 | |
| 561 | {"buffer_LRU_batches_evict" , "buffer" , |
| 562 | "Number of LRU batches" , |
| 563 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE, |
| 564 | MONITOR_LRU_BATCH_EVICT_COUNT}, |
| 565 | |
| 566 | {"buffer_LRU_batch_evict_pages" , "buffer" , |
| 567 | "Pages queued as an LRU batch" , |
| 568 | MONITOR_SET_MEMBER, MONITOR_LRU_BATCH_EVICT_TOTAL_PAGE, |
| 569 | MONITOR_LRU_BATCH_EVICT_PAGES}, |
| 570 | |
| 571 | /* Cumulative counter for single page LRU scans */ |
| 572 | {"buffer_LRU_single_flush_scanned" , "buffer" , |
| 573 | "Total pages scanned as part of single page LRU flush" , |
| 574 | MONITOR_SET_OWNER, |
| 575 | MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL, |
| 576 | MONITOR_LRU_SINGLE_FLUSH_SCANNED}, |
| 577 | |
| 578 | {"buffer_LRU_single_flush_num_scan" , "buffer" , |
| 579 | "Number of times single page LRU flush is called" , |
| 580 | MONITOR_SET_MEMBER, MONITOR_LRU_SINGLE_FLUSH_SCANNED, |
| 581 | MONITOR_LRU_SINGLE_FLUSH_SCANNED_NUM_CALL}, |
| 582 | |
| 583 | {"buffer_LRU_single_flush_scanned_per_call" , "buffer" , |
| 584 | "Page scanned per single LRU flush" , |
| 585 | MONITOR_SET_MEMBER, MONITOR_LRU_SINGLE_FLUSH_SCANNED, |
| 586 | MONITOR_LRU_SINGLE_FLUSH_SCANNED_PER_CALL}, |
| 587 | |
| 588 | {"buffer_LRU_single_flush_failure_count" , "Buffer" , |
| 589 | "Number of times attempt to flush a single page from LRU failed" , |
| 590 | MONITOR_NONE, |
| 591 | MONITOR_DEFAULT_START, MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT}, |
| 592 | |
| 593 | {"buffer_LRU_get_free_search" , "Buffer" , |
| 594 | "Number of searches performed for a clean page" , |
| 595 | MONITOR_NONE, |
| 596 | MONITOR_DEFAULT_START, MONITOR_LRU_GET_FREE_SEARCH}, |
| 597 | |
| 598 | /* Cumulative counter for LRU search scans */ |
| 599 | {"buffer_LRU_search_scanned" , "buffer" , |
| 600 | "Total pages scanned as part of LRU search" , |
| 601 | MONITOR_SET_OWNER, |
| 602 | MONITOR_LRU_SEARCH_SCANNED_NUM_CALL, |
| 603 | MONITOR_LRU_SEARCH_SCANNED}, |
| 604 | |
| 605 | {"buffer_LRU_search_num_scan" , "buffer" , |
| 606 | "Number of times LRU search is performed" , |
| 607 | MONITOR_SET_MEMBER, MONITOR_LRU_SEARCH_SCANNED, |
| 608 | MONITOR_LRU_SEARCH_SCANNED_NUM_CALL}, |
| 609 | |
| 610 | {"buffer_LRU_search_scanned_per_call" , "buffer" , |
| 611 | "Page scanned per single LRU search" , |
| 612 | MONITOR_SET_MEMBER, MONITOR_LRU_SEARCH_SCANNED, |
| 613 | MONITOR_LRU_SEARCH_SCANNED_PER_CALL}, |
| 614 | |
| 615 | /* Cumulative counter for LRU unzip search scans */ |
| 616 | {"buffer_LRU_unzip_search_scanned" , "buffer" , |
| 617 | "Total pages scanned as part of LRU unzip search" , |
| 618 | MONITOR_SET_OWNER, |
| 619 | MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL, |
| 620 | MONITOR_LRU_UNZIP_SEARCH_SCANNED}, |
| 621 | |
| 622 | {"buffer_LRU_unzip_search_num_scan" , "buffer" , |
| 623 | "Number of times LRU unzip search is performed" , |
| 624 | MONITOR_SET_MEMBER, MONITOR_LRU_UNZIP_SEARCH_SCANNED, |
| 625 | MONITOR_LRU_UNZIP_SEARCH_SCANNED_NUM_CALL}, |
| 626 | |
| 627 | {"buffer_LRU_unzip_search_scanned_per_call" , "buffer" , |
| 628 | "Page scanned per single LRU unzip search" , |
| 629 | MONITOR_SET_MEMBER, MONITOR_LRU_UNZIP_SEARCH_SCANNED, |
| 630 | MONITOR_LRU_UNZIP_SEARCH_SCANNED_PER_CALL}, |
| 631 | |
| 632 | /* ========== Counters for Buffer Page I/O ========== */ |
| 633 | {"module_buffer_page" , "buffer_page_io" , "Buffer Page I/O Module" , |
| 634 | static_cast<monitor_type_t>( |
| 635 | MONITOR_MODULE | MONITOR_GROUP_MODULE), |
| 636 | MONITOR_DEFAULT_START, MONITOR_MODULE_BUF_PAGE}, |
| 637 | |
| 638 | MONITOR_BUF_PAGE_READ("index_leaf" ,"Index Leaf" , INDEX_LEAF), |
| 639 | |
| 640 | MONITOR_BUF_PAGE_READ("index_non_leaf" ,"Index Non-leaf" , |
| 641 | INDEX_NON_LEAF), |
| 642 | |
| 643 | MONITOR_BUF_PAGE_READ("index_ibuf_leaf" , "Insert Buffer Index Leaf" , |
| 644 | INDEX_IBUF_LEAF), |
| 645 | |
| 646 | MONITOR_BUF_PAGE_READ("index_ibuf_non_leaf" , |
| 647 | "Insert Buffer Index Non-Leaf" , |
| 648 | INDEX_IBUF_NON_LEAF), |
| 649 | |
| 650 | MONITOR_BUF_PAGE_READ("undo_log" , "Undo Log" , UNDO_LOG), |
| 651 | |
| 652 | MONITOR_BUF_PAGE_READ("index_inode" , "Index Inode" , INODE), |
| 653 | |
| 654 | MONITOR_BUF_PAGE_READ("ibuf_free_list" , "Insert Buffer Free List" , |
| 655 | IBUF_FREELIST), |
| 656 | |
| 657 | MONITOR_BUF_PAGE_READ("ibuf_bitmap" , "Insert Buffer Bitmap" , |
| 658 | IBUF_BITMAP), |
| 659 | |
| 660 | MONITOR_BUF_PAGE_READ("system_page" , "System" , SYSTEM), |
| 661 | |
| 662 | MONITOR_BUF_PAGE_READ("trx_system" , "Transaction System" , TRX_SYSTEM), |
| 663 | |
| 664 | MONITOR_BUF_PAGE_READ("fsp_hdr" , "File Space Header" , FSP_HDR), |
| 665 | |
| 666 | MONITOR_BUF_PAGE_READ("xdes" , "Extent Descriptor" , XDES), |
| 667 | |
| 668 | MONITOR_BUF_PAGE_READ("blob" , "Uncompressed BLOB" , BLOB), |
| 669 | |
| 670 | MONITOR_BUF_PAGE_READ("zblob" , "First Compressed BLOB" , ZBLOB), |
| 671 | |
| 672 | MONITOR_BUF_PAGE_READ("zblob2" , "Subsequent Compressed BLOB" , ZBLOB2), |
| 673 | |
| 674 | MONITOR_BUF_PAGE_READ("other" , "other/unknown (old version of InnoDB)" , |
| 675 | OTHER), |
| 676 | |
| 677 | MONITOR_BUF_PAGE_WRITTEN("index_leaf" ,"Index Leaf" , INDEX_LEAF), |
| 678 | |
| 679 | MONITOR_BUF_PAGE_WRITTEN("index_non_leaf" ,"Index Non-leaf" , |
| 680 | INDEX_NON_LEAF), |
| 681 | |
| 682 | MONITOR_BUF_PAGE_WRITTEN("index_ibuf_leaf" , "Insert Buffer Index Leaf" , |
| 683 | INDEX_IBUF_LEAF), |
| 684 | |
| 685 | MONITOR_BUF_PAGE_WRITTEN("index_ibuf_non_leaf" , |
| 686 | "Insert Buffer Index Non-Leaf" , |
| 687 | INDEX_IBUF_NON_LEAF), |
| 688 | |
| 689 | MONITOR_BUF_PAGE_WRITTEN("undo_log" , "Undo Log" , UNDO_LOG), |
| 690 | |
| 691 | MONITOR_BUF_PAGE_WRITTEN("index_inode" , "Index Inode" , INODE), |
| 692 | |
| 693 | MONITOR_BUF_PAGE_WRITTEN("ibuf_free_list" , "Insert Buffer Free List" , |
| 694 | IBUF_FREELIST), |
| 695 | |
| 696 | MONITOR_BUF_PAGE_WRITTEN("ibuf_bitmap" , "Insert Buffer Bitmap" , |
| 697 | IBUF_BITMAP), |
| 698 | |
| 699 | MONITOR_BUF_PAGE_WRITTEN("system_page" , "System" , SYSTEM), |
| 700 | |
| 701 | MONITOR_BUF_PAGE_WRITTEN("trx_system" , "Transaction System" , |
| 702 | TRX_SYSTEM), |
| 703 | |
| 704 | MONITOR_BUF_PAGE_WRITTEN("fsp_hdr" , "File Space Header" , FSP_HDR), |
| 705 | |
| 706 | MONITOR_BUF_PAGE_WRITTEN("xdes" , "Extent Descriptor" , XDES), |
| 707 | |
| 708 | MONITOR_BUF_PAGE_WRITTEN("blob" , "Uncompressed BLOB" , BLOB), |
| 709 | |
| 710 | MONITOR_BUF_PAGE_WRITTEN("zblob" , "First Compressed BLOB" , ZBLOB), |
| 711 | |
| 712 | MONITOR_BUF_PAGE_WRITTEN("zblob2" , "Subsequent Compressed BLOB" , |
| 713 | ZBLOB2), |
| 714 | |
| 715 | MONITOR_BUF_PAGE_WRITTEN("other" , "other/unknown (old version InnoDB)" , |
| 716 | OTHER), |
| 717 | |
| 718 | /* ========== Counters for OS level operations ========== */ |
| 719 | {"module_os" , "os" , "OS Level Operation" , |
| 720 | MONITOR_MODULE, |
| 721 | MONITOR_DEFAULT_START, MONITOR_MODULE_OS}, |
| 722 | |
| 723 | {"os_data_reads" , "os" , |
| 724 | "Number of reads initiated (innodb_data_reads)" , |
| 725 | static_cast<monitor_type_t>( |
| 726 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 727 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FILE_READ}, |
| 728 | |
| 729 | {"os_data_writes" , "os" , |
| 730 | "Number of writes initiated (innodb_data_writes)" , |
| 731 | static_cast<monitor_type_t>( |
| 732 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 733 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FILE_WRITE}, |
| 734 | |
| 735 | {"os_data_fsyncs" , "os" , |
| 736 | "Number of fsync() calls (innodb_data_fsyncs)" , |
| 737 | static_cast<monitor_type_t>( |
| 738 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 739 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_FSYNC}, |
| 740 | |
| 741 | {"os_pending_reads" , "os" , "Number of reads pending" , |
| 742 | MONITOR_DEFAULT_ON, |
| 743 | MONITOR_DEFAULT_START, MONITOR_OS_PENDING_READS}, |
| 744 | |
| 745 | {"os_pending_writes" , "os" , "Number of writes pending" , |
| 746 | MONITOR_DEFAULT_ON, |
| 747 | MONITOR_DEFAULT_START, MONITOR_OS_PENDING_WRITES}, |
| 748 | |
| 749 | {"os_log_bytes_written" , "os" , |
| 750 | "Bytes of log written (innodb_os_log_written)" , |
| 751 | static_cast<monitor_type_t>( |
| 752 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 753 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_WRITTEN}, |
| 754 | |
| 755 | {"os_log_fsyncs" , "os" , |
| 756 | "Number of fsync log writes (innodb_os_log_fsyncs)" , |
| 757 | static_cast<monitor_type_t>( |
| 758 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 759 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_FSYNC}, |
| 760 | |
| 761 | {"os_log_pending_fsyncs" , "os" , |
| 762 | "Number of pending fsync write (innodb_os_log_pending_fsyncs)" , |
| 763 | static_cast<monitor_type_t>( |
| 764 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 765 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_FSYNC}, |
| 766 | |
| 767 | {"os_log_pending_writes" , "os" , |
| 768 | "Number of pending log file writes (innodb_os_log_pending_writes)" , |
| 769 | static_cast<monitor_type_t>( |
| 770 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 771 | MONITOR_DEFAULT_START, MONITOR_OVLD_OS_LOG_PENDING_WRITES}, |
| 772 | |
| 773 | /* ========== Counters for Transaction Module ========== */ |
| 774 | {"module_trx" , "transaction" , "Transaction Manager" , |
| 775 | MONITOR_MODULE, |
| 776 | MONITOR_DEFAULT_START, MONITOR_MODULE_TRX}, |
| 777 | |
| 778 | {"trx_rw_commits" , "transaction" , |
| 779 | "Number of read-write transactions committed" , |
| 780 | MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_RW_COMMIT}, |
| 781 | |
| 782 | {"trx_ro_commits" , "transaction" , |
| 783 | "Number of read-only transactions committed" , |
| 784 | MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_RO_COMMIT}, |
| 785 | |
| 786 | {"trx_nl_ro_commits" , "transaction" , |
| 787 | "Number of non-locking auto-commit read-only transactions committed" , |
| 788 | MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_TRX_NL_RO_COMMIT}, |
| 789 | |
| 790 | {"trx_commits_insert_update" , "transaction" , |
| 791 | "Number of transactions committed with inserts and updates" , |
| 792 | MONITOR_NONE, |
| 793 | MONITOR_DEFAULT_START, MONITOR_TRX_COMMIT_UNDO}, |
| 794 | |
| 795 | {"trx_rollbacks" , "transaction" , |
| 796 | "Number of transactions rolled back" , |
| 797 | MONITOR_NONE, |
| 798 | MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK}, |
| 799 | |
| 800 | {"trx_rollbacks_savepoint" , "transaction" , |
| 801 | "Number of transactions rolled back to savepoint" , |
| 802 | MONITOR_NONE, |
| 803 | MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_SAVEPOINT}, |
| 804 | |
| 805 | {"trx_rollback_active" , "transaction" , |
| 806 | "Number of resurrected active transactions rolled back" , |
| 807 | MONITOR_NONE, |
| 808 | MONITOR_DEFAULT_START, MONITOR_TRX_ROLLBACK_ACTIVE}, |
| 809 | |
| 810 | {"trx_active_transactions" , "transaction" , |
| 811 | "Number of active transactions" , |
| 812 | MONITOR_NONE, |
| 813 | MONITOR_DEFAULT_START, MONITOR_TRX_ACTIVE}, |
| 814 | |
| 815 | {"trx_rseg_history_len" , "transaction" , |
| 816 | "Length of the TRX_RSEG_HISTORY list" , |
| 817 | static_cast<monitor_type_t>( |
| 818 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 819 | MONITOR_DEFAULT_START, MONITOR_RSEG_HISTORY_LEN}, |
| 820 | |
| 821 | {"trx_undo_slots_used" , "transaction" , "Number of undo slots used" , |
| 822 | MONITOR_NONE, |
| 823 | MONITOR_DEFAULT_START, MONITOR_NUM_UNDO_SLOT_USED}, |
| 824 | |
| 825 | {"trx_undo_slots_cached" , "transaction" , |
| 826 | "Number of undo slots cached" , |
| 827 | MONITOR_NONE, |
| 828 | MONITOR_DEFAULT_START, MONITOR_NUM_UNDO_SLOT_CACHED}, |
| 829 | |
| 830 | {"trx_rseg_current_size" , "transaction" , |
| 831 | "Current rollback segment size in pages" , |
| 832 | static_cast<monitor_type_t>( |
| 833 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 834 | MONITOR_DEFAULT_START, MONITOR_RSEG_CUR_SIZE}, |
| 835 | |
| 836 | /* ========== Counters for Purge Module ========== */ |
| 837 | {"module_purge" , "purge" , "Purge Module" , |
| 838 | MONITOR_MODULE, |
| 839 | MONITOR_DEFAULT_START, MONITOR_MODULE_PURGE}, |
| 840 | |
| 841 | {"purge_del_mark_records" , "purge" , |
| 842 | "Number of delete-marked rows purged" , |
| 843 | MONITOR_NONE, |
| 844 | MONITOR_DEFAULT_START, MONITOR_N_DEL_ROW_PURGE}, |
| 845 | |
| 846 | {"purge_upd_exist_or_extern_records" , "purge" , |
| 847 | "Number of purges on updates of existing records and" |
| 848 | " updates on delete marked record with externally stored field" , |
| 849 | MONITOR_NONE, |
| 850 | MONITOR_DEFAULT_START, MONITOR_N_UPD_EXIST_EXTERN}, |
| 851 | |
| 852 | {"purge_invoked" , "purge" , |
| 853 | "Number of times purge was invoked" , |
| 854 | MONITOR_NONE, |
| 855 | MONITOR_DEFAULT_START, MONITOR_PURGE_INVOKED}, |
| 856 | |
| 857 | {"purge_undo_log_pages" , "purge" , |
| 858 | "Number of undo log pages handled by the purge" , |
| 859 | MONITOR_NONE, |
| 860 | MONITOR_DEFAULT_START, MONITOR_PURGE_N_PAGE_HANDLED}, |
| 861 | |
| 862 | {"purge_dml_delay_usec" , "purge" , |
| 863 | "Microseconds DML to be delayed due to purge lagging" , |
| 864 | MONITOR_DISPLAY_CURRENT, |
| 865 | MONITOR_DEFAULT_START, MONITOR_DML_PURGE_DELAY}, |
| 866 | |
| 867 | {"purge_stop_count" , "purge" , |
| 868 | "Number of times purge was stopped" , |
| 869 | MONITOR_DISPLAY_CURRENT, |
| 870 | MONITOR_DEFAULT_START, MONITOR_PURGE_STOP_COUNT}, |
| 871 | |
| 872 | {"purge_resume_count" , "purge" , |
| 873 | "Number of times purge was resumed" , |
| 874 | MONITOR_DISPLAY_CURRENT, |
| 875 | MONITOR_DEFAULT_START, MONITOR_PURGE_RESUME_COUNT}, |
| 876 | |
| 877 | /* ========== Counters for Recovery Module ========== */ |
| 878 | {"module_log" , "recovery" , "Recovery Module" , |
| 879 | MONITOR_MODULE, |
| 880 | MONITOR_DEFAULT_START, MONITOR_MODULE_RECOVERY}, |
| 881 | |
| 882 | {"log_checkpoints" , "recovery" , "Number of checkpoints" , |
| 883 | MONITOR_NONE, |
| 884 | MONITOR_DEFAULT_START, MONITOR_NUM_CHECKPOINT}, |
| 885 | |
| 886 | {"log_lsn_last_flush" , "recovery" , "LSN of Last flush" , |
| 887 | static_cast<monitor_type_t>( |
| 888 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 889 | MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_FLUSHDISK}, |
| 890 | |
| 891 | {"log_lsn_last_checkpoint" , "recovery" , "LSN at last checkpoint" , |
| 892 | static_cast<monitor_type_t>( |
| 893 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 894 | MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_CHECKPOINT}, |
| 895 | |
| 896 | {"log_lsn_current" , "recovery" , "Current LSN value" , |
| 897 | static_cast<monitor_type_t>( |
| 898 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 899 | MONITOR_DEFAULT_START, MONITOR_OVLD_LSN_CURRENT}, |
| 900 | |
| 901 | {"log_lsn_checkpoint_age" , "recovery" , |
| 902 | "Current LSN value minus LSN at last checkpoint" , |
| 903 | MONITOR_NONE, |
| 904 | MONITOR_DEFAULT_START, MONITOR_LSN_CHECKPOINT_AGE}, |
| 905 | |
| 906 | {"log_lsn_buf_pool_oldest" , "recovery" , |
| 907 | "The oldest modified block LSN in the buffer pool" , |
| 908 | static_cast<monitor_type_t>( |
| 909 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 910 | MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_OLDEST_LSN}, |
| 911 | |
| 912 | {"log_max_modified_age_async" , "recovery" , |
| 913 | "Maximum LSN difference; when exceeded, start asynchronous preflush" , |
| 914 | static_cast<monitor_type_t>( |
| 915 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 916 | MONITOR_DEFAULT_START, MONITOR_OVLD_MAX_AGE_ASYNC}, |
| 917 | |
| 918 | {"log_max_modified_age_sync" , "recovery" , |
| 919 | "Maximum LSN difference; when exceeded, start synchronous preflush" , |
| 920 | static_cast<monitor_type_t>( |
| 921 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), |
| 922 | MONITOR_DEFAULT_START, MONITOR_OVLD_MAX_AGE_SYNC}, |
| 923 | |
| 924 | {"log_pending_log_flushes" , "recovery" , "Pending log flushes" , |
| 925 | MONITOR_NONE, |
| 926 | MONITOR_DEFAULT_START, MONITOR_PENDING_LOG_FLUSH}, |
| 927 | |
| 928 | {"log_pending_checkpoint_writes" , "recovery" , "Pending checkpoints" , |
| 929 | MONITOR_NONE, |
| 930 | MONITOR_DEFAULT_START, MONITOR_PENDING_CHECKPOINT_WRITE}, |
| 931 | |
| 932 | {"log_num_log_io" , "recovery" , "Number of log I/Os" , |
| 933 | MONITOR_NONE, |
| 934 | MONITOR_DEFAULT_START, MONITOR_LOG_IO}, |
| 935 | |
| 936 | {"log_waits" , "recovery" , |
| 937 | "Number of log waits due to small log buffer (innodb_log_waits)" , |
| 938 | static_cast<monitor_type_t>( |
| 939 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 940 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WAITS}, |
| 941 | |
| 942 | {"log_write_requests" , "recovery" , |
| 943 | "Number of log write requests (innodb_log_write_requests)" , |
| 944 | static_cast<monitor_type_t>( |
| 945 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 946 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WRITE_REQUEST}, |
| 947 | |
| 948 | {"log_writes" , "recovery" , |
| 949 | "Number of log writes (innodb_log_writes)" , |
| 950 | static_cast<monitor_type_t>( |
| 951 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 952 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_WRITES}, |
| 953 | |
| 954 | {"log_padded" , "recovery" , |
| 955 | "Bytes of log padded for log write ahead" , |
| 956 | static_cast<monitor_type_t>( |
| 957 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 958 | MONITOR_DEFAULT_START, MONITOR_OVLD_LOG_PADDED}, |
| 959 | |
| 960 | /* ========== Counters for Page Compression ========== */ |
| 961 | {"module_compress" , "compression" , "Page Compression Info" , |
| 962 | MONITOR_MODULE, |
| 963 | MONITOR_DEFAULT_START, MONITOR_MODULE_PAGE}, |
| 964 | |
| 965 | {"compress_pages_compressed" , "compression" , |
| 966 | "Number of pages compressed" , MONITOR_NONE, |
| 967 | MONITOR_DEFAULT_START, MONITOR_PAGE_COMPRESS}, |
| 968 | |
| 969 | {"compress_pages_decompressed" , "compression" , |
| 970 | "Number of pages decompressed" , |
| 971 | MONITOR_NONE, |
| 972 | MONITOR_DEFAULT_START, MONITOR_PAGE_DECOMPRESS}, |
| 973 | |
| 974 | {"compression_pad_increments" , "compression" , |
| 975 | "Number of times padding is incremented to avoid compression failures" , |
| 976 | MONITOR_NONE, |
| 977 | MONITOR_DEFAULT_START, MONITOR_PAD_INCREMENTS}, |
| 978 | |
| 979 | {"compression_pad_decrements" , "compression" , |
| 980 | "Number of times padding is decremented due to good compressibility" , |
| 981 | MONITOR_NONE, |
| 982 | MONITOR_DEFAULT_START, MONITOR_PAD_DECREMENTS}, |
| 983 | |
| 984 | {"compress_saved" , "compression" , |
| 985 | "Number of bytes saved by page compression" , |
| 986 | MONITOR_NONE, |
| 987 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESS_SAVED}, |
| 988 | |
| 989 | {"compress_pages_page_compressed" , "compression" , |
| 990 | "Number of pages compressed by page compression" , |
| 991 | MONITOR_NONE, |
| 992 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_PAGE_COMPRESSED}, |
| 993 | |
| 994 | {"compress_page_compressed_trim_op" , "compression" , |
| 995 | "Number of TRIM operation performed by page compression" , |
| 996 | MONITOR_NONE, |
| 997 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP}, |
| 998 | |
| 999 | {"compress_pages_page_decompressed" , "compression" , |
| 1000 | "Number of pages decompressed by page compression" , |
| 1001 | MONITOR_NONE, |
| 1002 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED}, |
| 1003 | |
| 1004 | {"compress_pages_page_compression_error" , "compression" , |
| 1005 | "Number of page compression errors" , |
| 1006 | MONITOR_NONE, |
| 1007 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR}, |
| 1008 | |
| 1009 | {"compress_pages_encrypted" , "compression" , |
| 1010 | "Number of pages encrypted" , |
| 1011 | MONITOR_NONE, |
| 1012 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_ENCRYPTED}, |
| 1013 | |
| 1014 | {"compress_pages_decrypted" , "compression" , |
| 1015 | "Number of pages decrypted" , |
| 1016 | MONITOR_NONE, |
| 1017 | MONITOR_DEFAULT_START, MONITOR_OVLD_PAGES_DECRYPTED}, |
| 1018 | |
| 1019 | /* ========== Counters for Index ========== */ |
| 1020 | {"module_index" , "index" , "Index Manager" , |
| 1021 | MONITOR_MODULE, |
| 1022 | MONITOR_DEFAULT_START, MONITOR_MODULE_INDEX}, |
| 1023 | |
| 1024 | {"index_page_splits" , "index" , "Number of index page splits" , |
| 1025 | MONITOR_NONE, |
| 1026 | MONITOR_DEFAULT_START, MONITOR_INDEX_SPLIT}, |
| 1027 | |
| 1028 | {"index_page_merge_attempts" , "index" , |
| 1029 | "Number of index page merge attempts" , |
| 1030 | MONITOR_NONE, |
| 1031 | MONITOR_DEFAULT_START, MONITOR_INDEX_MERGE_ATTEMPTS}, |
| 1032 | |
| 1033 | {"index_page_merge_successful" , "index" , |
| 1034 | "Number of successful index page merges" , |
| 1035 | MONITOR_NONE, |
| 1036 | MONITOR_DEFAULT_START, MONITOR_INDEX_MERGE_SUCCESSFUL}, |
| 1037 | |
| 1038 | {"index_page_reorg_attempts" , "index" , |
| 1039 | "Number of index page reorganization attempts" , |
| 1040 | MONITOR_NONE, |
| 1041 | MONITOR_DEFAULT_START, MONITOR_INDEX_REORG_ATTEMPTS}, |
| 1042 | |
| 1043 | {"index_page_reorg_successful" , "index" , |
| 1044 | "Number of successful index page reorganizations" , |
| 1045 | MONITOR_NONE, |
| 1046 | MONITOR_DEFAULT_START, MONITOR_INDEX_REORG_SUCCESSFUL}, |
| 1047 | |
| 1048 | {"index_page_discards" , "index" , "Number of index pages discarded" , |
| 1049 | MONITOR_NONE, |
| 1050 | MONITOR_DEFAULT_START, MONITOR_INDEX_DISCARD}, |
| 1051 | |
| 1052 | #ifdef BTR_CUR_HASH_ADAPT |
| 1053 | /* ========== Counters for Adaptive Hash Index ========== */ |
| 1054 | {"module_adaptive_hash" , "adaptive_hash_index" , "Adaptive Hash Index" , |
| 1055 | MONITOR_MODULE, |
| 1056 | MONITOR_DEFAULT_START, MONITOR_MODULE_ADAPTIVE_HASH}, |
| 1057 | |
| 1058 | {"adaptive_hash_searches" , "adaptive_hash_index" , |
| 1059 | "Number of successful searches using Adaptive Hash Index" , |
| 1060 | static_cast<monitor_type_t>( |
| 1061 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1062 | MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH}, |
| 1063 | #endif /* BTR_CUR_HASH_ADAPT */ |
| 1064 | |
| 1065 | {"adaptive_hash_searches_btree" , "adaptive_hash_index" , |
| 1066 | "Number of searches using B-tree on an index search" , |
| 1067 | static_cast<monitor_type_t>( |
| 1068 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1069 | MONITOR_DEFAULT_START, MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE}, |
| 1070 | |
| 1071 | #ifdef BTR_CUR_HASH_ADAPT |
| 1072 | {"adaptive_hash_pages_added" , "adaptive_hash_index" , |
| 1073 | "Number of index pages on which the Adaptive Hash Index is built" , |
| 1074 | MONITOR_NONE, |
| 1075 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_PAGE_ADDED}, |
| 1076 | |
| 1077 | {"adaptive_hash_pages_removed" , "adaptive_hash_index" , |
| 1078 | "Number of index pages whose corresponding Adaptive Hash Index" |
| 1079 | " entries were removed" , |
| 1080 | MONITOR_NONE, |
| 1081 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_PAGE_REMOVED}, |
| 1082 | |
| 1083 | {"adaptive_hash_rows_added" , "adaptive_hash_index" , |
| 1084 | "Number of Adaptive Hash Index rows added" , |
| 1085 | MONITOR_NONE, |
| 1086 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_ADDED}, |
| 1087 | |
| 1088 | {"adaptive_hash_rows_removed" , "adaptive_hash_index" , |
| 1089 | "Number of Adaptive Hash Index rows removed" , |
| 1090 | MONITOR_NONE, |
| 1091 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_REMOVED}, |
| 1092 | |
| 1093 | {"adaptive_hash_rows_deleted_no_hash_entry" , "adaptive_hash_index" , |
| 1094 | "Number of rows deleted that did not have corresponding Adaptive Hash" |
| 1095 | " Index entries" , |
| 1096 | MONITOR_NONE, |
| 1097 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_REMOVE_NOT_FOUND}, |
| 1098 | |
| 1099 | {"adaptive_hash_rows_updated" , "adaptive_hash_index" , |
| 1100 | "Number of Adaptive Hash Index rows updated" , |
| 1101 | MONITOR_NONE, |
| 1102 | MONITOR_DEFAULT_START, MONITOR_ADAPTIVE_HASH_ROW_UPDATED}, |
| 1103 | #endif /* BTR_CUR_HASH_ADAPT */ |
| 1104 | |
| 1105 | /* ========== Counters for tablespace ========== */ |
| 1106 | {"module_file" , "file_system" , "Tablespace and File System Manager" , |
| 1107 | MONITOR_MODULE, |
| 1108 | MONITOR_DEFAULT_START, MONITOR_MODULE_FIL_SYSTEM}, |
| 1109 | |
| 1110 | {"file_num_open_files" , "file_system" , |
| 1111 | "Number of files currently open (innodb_num_open_files)" , |
| 1112 | static_cast<monitor_type_t>( |
| 1113 | MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON), |
| 1114 | MONITOR_DEFAULT_START, MONITOR_OVLD_N_FILE_OPENED}, |
| 1115 | |
| 1116 | /* ========== Counters for Change Buffer ========== */ |
| 1117 | {"module_ibuf_system" , "change_buffer" , "InnoDB Change Buffer" , |
| 1118 | MONITOR_MODULE, |
| 1119 | MONITOR_DEFAULT_START, MONITOR_MODULE_IBUF_SYSTEM}, |
| 1120 | |
| 1121 | {"ibuf_merges_insert" , "change_buffer" , |
| 1122 | "Number of inserted records merged by change buffering" , |
| 1123 | static_cast<monitor_type_t>( |
| 1124 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1125 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_INSERT}, |
| 1126 | |
| 1127 | {"ibuf_merges_delete_mark" , "change_buffer" , |
| 1128 | "Number of deleted records merged by change buffering" , |
| 1129 | static_cast<monitor_type_t>( |
| 1130 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1131 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DELETE}, |
| 1132 | |
| 1133 | {"ibuf_merges_delete" , "change_buffer" , |
| 1134 | "Number of purge records merged by change buffering" , |
| 1135 | static_cast<monitor_type_t>( |
| 1136 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1137 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_PURGE}, |
| 1138 | |
| 1139 | {"ibuf_merges_discard_insert" , "change_buffer" , |
| 1140 | "Number of insert merged operations discarded" , |
| 1141 | static_cast<monitor_type_t>( |
| 1142 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1143 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT}, |
| 1144 | |
| 1145 | {"ibuf_merges_discard_delete_mark" , "change_buffer" , |
| 1146 | "Number of deleted merged operations discarded" , |
| 1147 | static_cast<monitor_type_t>( |
| 1148 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1149 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE}, |
| 1150 | |
| 1151 | {"ibuf_merges_discard_delete" , "change_buffer" , |
| 1152 | "Number of purge merged operations discarded" , |
| 1153 | static_cast<monitor_type_t>( |
| 1154 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1155 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE}, |
| 1156 | |
| 1157 | {"ibuf_merges" , "change_buffer" , "Number of change buffer merges" , |
| 1158 | static_cast<monitor_type_t>( |
| 1159 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1160 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_MERGES}, |
| 1161 | |
| 1162 | {"ibuf_size" , "change_buffer" , "Change buffer size in pages" , |
| 1163 | static_cast<monitor_type_t>( |
| 1164 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1165 | MONITOR_DEFAULT_START, MONITOR_OVLD_IBUF_SIZE}, |
| 1166 | |
| 1167 | /* ========== Counters for server operations ========== */ |
| 1168 | {"module_innodb" , "innodb" , |
| 1169 | "Counter for general InnoDB server wide operations and properties" , |
| 1170 | MONITOR_MODULE, |
| 1171 | MONITOR_DEFAULT_START, MONITOR_MODULE_SERVER}, |
| 1172 | |
| 1173 | {"innodb_master_thread_sleeps" , "server" , |
| 1174 | "Number of times (seconds) master thread sleeps" , |
| 1175 | MONITOR_NONE, |
| 1176 | MONITOR_DEFAULT_START, MONITOR_MASTER_THREAD_SLEEP}, |
| 1177 | |
| 1178 | {"innodb_activity_count" , "server" , "Current server activity count" , |
| 1179 | static_cast<monitor_type_t>( |
| 1180 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1181 | MONITOR_DEFAULT_START, MONITOR_OVLD_SERVER_ACTIVITY}, |
| 1182 | |
| 1183 | {"innodb_master_active_loops" , "server" , |
| 1184 | "Number of times master thread performs its tasks when" |
| 1185 | " server is active" , |
| 1186 | MONITOR_NONE, |
| 1187 | MONITOR_DEFAULT_START, MONITOR_MASTER_ACTIVE_LOOPS}, |
| 1188 | |
| 1189 | {"innodb_master_idle_loops" , "server" , |
| 1190 | "Number of times master thread performs its tasks when server is idle" , |
| 1191 | MONITOR_NONE, |
| 1192 | MONITOR_DEFAULT_START, MONITOR_MASTER_IDLE_LOOPS}, |
| 1193 | |
| 1194 | {"innodb_background_drop_table_usec" , "server" , |
| 1195 | "Time (in microseconds) spent to process drop table list" , |
| 1196 | MONITOR_NONE, |
| 1197 | MONITOR_DEFAULT_START, MONITOR_SRV_BACKGROUND_DROP_TABLE_MICROSECOND}, |
| 1198 | |
| 1199 | {"innodb_ibuf_merge_usec" , "server" , |
| 1200 | "Time (in microseconds) spent to process change buffer merge" , |
| 1201 | MONITOR_NONE, |
| 1202 | MONITOR_DEFAULT_START, MONITOR_SRV_IBUF_MERGE_MICROSECOND}, |
| 1203 | |
| 1204 | {"innodb_log_flush_usec" , "server" , |
| 1205 | "Time (in microseconds) spent to flush log records" , |
| 1206 | MONITOR_NONE, |
| 1207 | MONITOR_DEFAULT_START, MONITOR_SRV_LOG_FLUSH_MICROSECOND}, |
| 1208 | |
| 1209 | {"innodb_mem_validate_usec" , "server" , |
| 1210 | "Time (in microseconds) spent to do memory validation" , |
| 1211 | MONITOR_NONE, |
| 1212 | MONITOR_DEFAULT_START, MONITOR_SRV_MEM_VALIDATE_MICROSECOND}, |
| 1213 | |
| 1214 | {"innodb_master_purge_usec" , "server" , |
| 1215 | "Time (in microseconds) spent by master thread to purge records" , |
| 1216 | MONITOR_NONE, |
| 1217 | MONITOR_DEFAULT_START, MONITOR_SRV_PURGE_MICROSECOND}, |
| 1218 | |
| 1219 | {"innodb_dict_lru_usec" , "server" , |
| 1220 | "Time (in microseconds) spent to process DICT LRU list" , |
| 1221 | MONITOR_NONE, |
| 1222 | MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_MICROSECOND}, |
| 1223 | |
| 1224 | {"innodb_dict_lru_count_active" , "server" , |
| 1225 | "Number of tables evicted from DICT LRU list in the active loop" , |
| 1226 | MONITOR_NONE, |
| 1227 | MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_ACTIVE}, |
| 1228 | |
| 1229 | {"innodb_dict_lru_count_idle" , "server" , |
| 1230 | "Number of tables evicted from DICT LRU list in the idle loop" , |
| 1231 | MONITOR_NONE, |
| 1232 | MONITOR_DEFAULT_START, MONITOR_SRV_DICT_LRU_EVICT_COUNT_IDLE}, |
| 1233 | |
| 1234 | {"innodb_checkpoint_usec" , "server" , |
| 1235 | "Time (in microseconds) spent by master thread to do checkpoint" , |
| 1236 | MONITOR_NONE, |
| 1237 | MONITOR_DEFAULT_START, MONITOR_SRV_CHECKPOINT_MICROSECOND}, |
| 1238 | |
| 1239 | {"innodb_dblwr_writes" , "server" , |
| 1240 | "Number of doublewrite operations that have been performed" |
| 1241 | " (innodb_dblwr_writes)" , |
| 1242 | static_cast<monitor_type_t>( |
| 1243 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1244 | MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_DBLWR_WRITES}, |
| 1245 | |
| 1246 | {"innodb_dblwr_pages_written" , "server" , |
| 1247 | "Number of pages that have been written for doublewrite operations" |
| 1248 | " (innodb_dblwr_pages_written)" , |
| 1249 | static_cast<monitor_type_t>( |
| 1250 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1251 | MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN}, |
| 1252 | |
| 1253 | {"innodb_page_size" , "server" , |
| 1254 | "InnoDB page size in bytes (innodb_page_size)" , |
| 1255 | static_cast<monitor_type_t>( |
| 1256 | MONITOR_EXISTING | MONITOR_DEFAULT_ON | MONITOR_DISPLAY_CURRENT), |
| 1257 | MONITOR_DEFAULT_START, MONITOR_OVLD_SRV_PAGE_SIZE}, |
| 1258 | |
| 1259 | {"innodb_rwlock_s_spin_waits" , "server" , |
| 1260 | "Number of rwlock spin waits due to shared latch request" , |
| 1261 | static_cast<monitor_type_t>( |
| 1262 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1263 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_SPIN_WAITS}, |
| 1264 | |
| 1265 | {"innodb_rwlock_x_spin_waits" , "server" , |
| 1266 | "Number of rwlock spin waits due to exclusive latch request" , |
| 1267 | static_cast<monitor_type_t>( |
| 1268 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1269 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_SPIN_WAITS}, |
| 1270 | |
| 1271 | {"innodb_rwlock_sx_spin_waits" , "server" , |
| 1272 | "Number of rwlock spin waits due to sx latch request" , |
| 1273 | static_cast<monitor_type_t>( |
| 1274 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1275 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_SPIN_WAITS}, |
| 1276 | |
| 1277 | {"innodb_rwlock_s_spin_rounds" , "server" , |
| 1278 | "Number of rwlock spin loop rounds due to shared latch request" , |
| 1279 | static_cast<monitor_type_t>( |
| 1280 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1281 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS}, |
| 1282 | |
| 1283 | {"innodb_rwlock_x_spin_rounds" , "server" , |
| 1284 | "Number of rwlock spin loop rounds due to exclusive latch request" , |
| 1285 | static_cast<monitor_type_t>( |
| 1286 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1287 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS}, |
| 1288 | |
| 1289 | {"innodb_rwlock_sx_spin_rounds" , "server" , |
| 1290 | "Number of rwlock spin loop rounds due to sx latch request" , |
| 1291 | static_cast<monitor_type_t>( |
| 1292 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1293 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_SPIN_ROUNDS}, |
| 1294 | |
| 1295 | {"innodb_rwlock_s_os_waits" , "server" , |
| 1296 | "Number of OS waits due to shared latch request" , |
| 1297 | static_cast<monitor_type_t>( |
| 1298 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1299 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_S_OS_WAITS}, |
| 1300 | |
| 1301 | {"innodb_rwlock_x_os_waits" , "server" , |
| 1302 | "Number of OS waits due to exclusive latch request" , |
| 1303 | static_cast<monitor_type_t>( |
| 1304 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1305 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_X_OS_WAITS}, |
| 1306 | |
| 1307 | {"innodb_rwlock_sx_os_waits" , "server" , |
| 1308 | "Number of OS waits due to sx latch request" , |
| 1309 | static_cast<monitor_type_t>( |
| 1310 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1311 | MONITOR_DEFAULT_START, MONITOR_OVLD_RWLOCK_SX_OS_WAITS}, |
| 1312 | |
| 1313 | /* ========== Counters for DML operations ========== */ |
| 1314 | {"module_dml" , "dml" , "Statistics for DMLs" , |
| 1315 | MONITOR_MODULE, |
| 1316 | MONITOR_DEFAULT_START, MONITOR_MODULE_DML_STATS}, |
| 1317 | |
| 1318 | {"dml_reads" , "dml" , "Number of rows read" , |
| 1319 | static_cast<monitor_type_t>(MONITOR_EXISTING), |
| 1320 | MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_READ}, |
| 1321 | |
| 1322 | {"dml_inserts" , "dml" , "Number of rows inserted" , |
| 1323 | static_cast<monitor_type_t>( |
| 1324 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1325 | MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_INSERTED}, |
| 1326 | |
| 1327 | {"dml_deletes" , "dml" , "Number of rows deleted" , |
| 1328 | static_cast<monitor_type_t>( |
| 1329 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1330 | MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_DELETED}, |
| 1331 | |
| 1332 | {"dml_updates" , "dml" , "Number of rows updated" , |
| 1333 | static_cast<monitor_type_t>( |
| 1334 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1335 | MONITOR_DEFAULT_START, MONITOR_OLVD_ROW_UPDTATED}, |
| 1336 | |
| 1337 | {"dml_system_reads" , "dml" , "Number of system rows read" , |
| 1338 | static_cast<monitor_type_t>( |
| 1339 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1340 | MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_READ}, |
| 1341 | |
| 1342 | {"dml_system_inserts" , "dml" , "Number of system rows inserted" , |
| 1343 | static_cast<monitor_type_t>( |
| 1344 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1345 | MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_INSERTED}, |
| 1346 | |
| 1347 | {"dml_system_deletes" , "dml" , "Number of system rows deleted" , |
| 1348 | static_cast<monitor_type_t>( |
| 1349 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1350 | MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_DELETED}, |
| 1351 | |
| 1352 | {"dml_system_updates" , "dml" , "Number of system rows updated" , |
| 1353 | static_cast<monitor_type_t>( |
| 1354 | MONITOR_EXISTING | MONITOR_DEFAULT_ON), |
| 1355 | MONITOR_DEFAULT_START, MONITOR_OLVD_SYSTEM_ROW_UPDATED}, |
| 1356 | |
| 1357 | /* ========== Counters for DDL operations ========== */ |
| 1358 | {"module_ddl" , "ddl" , "Statistics for DDLs" , |
| 1359 | MONITOR_MODULE, |
| 1360 | MONITOR_DEFAULT_START, MONITOR_MODULE_DDL_STATS}, |
| 1361 | |
| 1362 | {"ddl_background_drop_indexes" , "ddl" , |
| 1363 | "Number of indexes waiting to be dropped after failed index creation" , |
| 1364 | MONITOR_NONE, |
| 1365 | MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_INDEX}, |
| 1366 | |
| 1367 | {"ddl_background_drop_tables" , "ddl" , |
| 1368 | "Number of tables in background drop table list" , |
| 1369 | MONITOR_NONE, |
| 1370 | MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_TABLE}, |
| 1371 | |
| 1372 | {"ddl_online_create_index" , "ddl" , |
| 1373 | "Number of indexes being created online" , |
| 1374 | MONITOR_NONE, |
| 1375 | MONITOR_DEFAULT_START, MONITOR_ONLINE_CREATE_INDEX}, |
| 1376 | |
| 1377 | {"ddl_pending_alter_table" , "ddl" , |
| 1378 | "Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress" , |
| 1379 | MONITOR_NONE, |
| 1380 | MONITOR_DEFAULT_START, MONITOR_PENDING_ALTER_TABLE}, |
| 1381 | |
| 1382 | {"ddl_sort_file_alter_table" , "ddl" , |
| 1383 | "Number of sort files created during alter table" , |
| 1384 | MONITOR_NONE, |
| 1385 | MONITOR_DEFAULT_START, MONITOR_ALTER_TABLE_SORT_FILES}, |
| 1386 | |
| 1387 | {"ddl_log_file_alter_table" , "ddl" , |
| 1388 | "Number of log files created during alter table" , |
| 1389 | MONITOR_NONE, |
| 1390 | MONITOR_DEFAULT_START, MONITOR_ALTER_TABLE_LOG_FILES}, |
| 1391 | |
| 1392 | /* ===== Counters for ICP (Index Condition Pushdown) Module ===== */ |
| 1393 | {"module_icp" , "icp" , "Index Condition Pushdown" , |
| 1394 | MONITOR_MODULE, |
| 1395 | MONITOR_DEFAULT_START, MONITOR_MODULE_ICP}, |
| 1396 | |
| 1397 | {"icp_attempts" , "icp" , |
| 1398 | "Number of attempts for index push-down condition checks" , |
| 1399 | MONITOR_NONE, |
| 1400 | MONITOR_DEFAULT_START, MONITOR_ICP_ATTEMPTS}, |
| 1401 | |
| 1402 | {"icp_no_match" , "icp" , "Index push-down condition does not match" , |
| 1403 | MONITOR_NONE, |
| 1404 | MONITOR_DEFAULT_START, MONITOR_ICP_NO_MATCH}, |
| 1405 | |
| 1406 | {"icp_out_of_range" , "icp" , "Index push-down condition out of range" , |
| 1407 | MONITOR_NONE, |
| 1408 | MONITOR_DEFAULT_START, MONITOR_ICP_OUT_OF_RANGE}, |
| 1409 | |
| 1410 | {"icp_match" , "icp" , "Index push-down condition matches" , |
| 1411 | MONITOR_NONE, |
| 1412 | MONITOR_DEFAULT_START, MONITOR_ICP_MATCH}, |
| 1413 | |
| 1414 | /* ========== Mutex monitoring on/off ========== */ |
| 1415 | {"latch_status" , "Latch counters" , |
| 1416 | "Collect latch counters to display via SHOW ENGING INNODB MUTEX" , |
| 1417 | MONITOR_MODULE, |
| 1418 | MONITOR_DEFAULT_START, MONITOR_MODULE_LATCHES}, |
| 1419 | |
| 1420 | {"latch" , "sync" , "Latch monitoring control" , |
| 1421 | MONITOR_HIDDEN, |
| 1422 | MONITOR_DEFAULT_START, MONITOR_LATCHES}, |
| 1423 | |
| 1424 | /* ========== To turn on/off reset all counters ========== */ |
| 1425 | {"all" , "All Counters" , "Turn on/off and reset all counters" , |
| 1426 | MONITOR_MODULE, |
| 1427 | MONITOR_DEFAULT_START, MONITOR_ALL_COUNTER} |
| 1428 | }; |
| 1429 | |
| 1430 | /* The "innodb_counter_value" array stores actual counter values */ |
| 1431 | monitor_value_t innodb_counter_value[NUM_MONITOR]; |
| 1432 | |
| 1433 | /* monitor_set_tbl is used to record and determine whether a monitor |
| 1434 | has been turned on/off. */ |
| 1435 | ulint monitor_set_tbl[(NUM_MONITOR + NUM_BITS_ULINT |
| 1436 | - 1) / NUM_BITS_ULINT]; |
| 1437 | |
| 1438 | /****************************************************************//** |
| 1439 | Get a monitor's "monitor_info" by its monitor id (index into the |
| 1440 | innodb_counter_info array. |
| 1441 | @return Point to corresponding monitor_info_t, or NULL if no such |
| 1442 | monitor */ |
| 1443 | monitor_info_t* |
| 1444 | srv_mon_get_info( |
| 1445 | /*=============*/ |
| 1446 | monitor_id_t monitor_id) /*!< id indexing into the |
| 1447 | innodb_counter_info array */ |
| 1448 | { |
| 1449 | ut_a(monitor_id < NUM_MONITOR); |
| 1450 | |
| 1451 | return((monitor_id < NUM_MONITOR) |
| 1452 | ? &innodb_counter_info[monitor_id] |
| 1453 | : NULL); |
| 1454 | } |
| 1455 | |
| 1456 | /****************************************************************//** |
| 1457 | Get monitor's name by its monitor id (indexing into the |
| 1458 | innodb_counter_info array. |
| 1459 | @return corresponding monitor name, or NULL if no such |
| 1460 | monitor */ |
| 1461 | const char* |
| 1462 | srv_mon_get_name( |
| 1463 | /*=============*/ |
| 1464 | monitor_id_t monitor_id) /*!< id index into the |
| 1465 | innodb_counter_info array */ |
| 1466 | { |
| 1467 | ut_a(monitor_id < NUM_MONITOR); |
| 1468 | |
| 1469 | return((monitor_id < NUM_MONITOR) |
| 1470 | ? innodb_counter_info[monitor_id].monitor_name |
| 1471 | : NULL); |
| 1472 | } |
| 1473 | |
| 1474 | /****************************************************************//** |
| 1475 | Turn on/off, reset monitor counters in a module. If module_id |
| 1476 | is MONITOR_ALL_COUNTER then turn on all monitor counters. |
| 1477 | turned on because it has already been turned on. */ |
| 1478 | void |
| 1479 | srv_mon_set_module_control( |
| 1480 | /*=======================*/ |
| 1481 | monitor_id_t module_id, /*!< in: Module ID as in |
| 1482 | monitor_counter_id. If it is |
| 1483 | set to MONITOR_ALL_COUNTER, this means |
| 1484 | we shall turn on all the counters */ |
| 1485 | mon_option_t set_option) /*!< in: Turn on/off reset the |
| 1486 | counter */ |
| 1487 | { |
| 1488 | lint ix; |
| 1489 | lint start_id; |
| 1490 | ibool set_current_module = FALSE; |
| 1491 | |
| 1492 | ut_a(module_id <= NUM_MONITOR); |
| 1493 | ut_a(UT_ARR_SIZE(innodb_counter_info) == NUM_MONITOR); |
| 1494 | |
| 1495 | /* The module_id must be an ID of MONITOR_MODULE type */ |
| 1496 | ut_a(innodb_counter_info[module_id].monitor_type & MONITOR_MODULE); |
| 1497 | |
| 1498 | /* start with the first monitor in the module. If module_id |
| 1499 | is MONITOR_ALL_COUNTER, this means we need to turn on all |
| 1500 | monitor counters. */ |
| 1501 | if (module_id == MONITOR_ALL_COUNTER) { |
| 1502 | start_id = 1; |
| 1503 | } else if (innodb_counter_info[module_id].monitor_type |
| 1504 | & MONITOR_GROUP_MODULE) { |
| 1505 | /* Counters in this module are set as a group together |
| 1506 | and cannot be turned on/off individually. Need to set |
| 1507 | the on/off bit in the module counter */ |
| 1508 | start_id = module_id; |
| 1509 | set_current_module = TRUE; |
| 1510 | |
| 1511 | } else { |
| 1512 | start_id = module_id + 1; |
| 1513 | } |
| 1514 | |
| 1515 | for (ix = start_id; ix < NUM_MONITOR; ix++) { |
| 1516 | /* if we hit the next module counter, we will |
| 1517 | continue if we want to turn on all monitor counters, |
| 1518 | and break if just turn on the counters in the |
| 1519 | current module. */ |
| 1520 | if (innodb_counter_info[ix].monitor_type & MONITOR_MODULE) { |
| 1521 | |
| 1522 | if (set_current_module) { |
| 1523 | /* Continue to set on/off bit on current |
| 1524 | module */ |
| 1525 | set_current_module = FALSE; |
| 1526 | } else if (module_id == MONITOR_ALL_COUNTER) { |
| 1527 | if (!(innodb_counter_info[ix].monitor_type |
| 1528 | & MONITOR_GROUP_MODULE)) { |
| 1529 | continue; |
| 1530 | } |
| 1531 | } else { |
| 1532 | /* Hitting the next module, stop */ |
| 1533 | break; |
| 1534 | } |
| 1535 | } |
| 1536 | |
| 1537 | /* Cannot turn on a monitor already been turned on. User |
| 1538 | should be aware some counters are already on before |
| 1539 | turn them on again (which could reset counter value) */ |
| 1540 | if (MONITOR_IS_ON(ix) && (set_option == MONITOR_TURN_ON)) { |
| 1541 | ib::info() << "Monitor '" |
| 1542 | << srv_mon_get_name((monitor_id_t) ix) |
| 1543 | << "' is already enabled." ; |
| 1544 | continue; |
| 1545 | } |
| 1546 | |
| 1547 | /* For some existing counters (server status variables), |
| 1548 | we will get its counter value at the start/stop time |
| 1549 | to calculate the actual value during the time. */ |
| 1550 | if (innodb_counter_info[ix].monitor_type & MONITOR_EXISTING) { |
| 1551 | srv_mon_process_existing_counter( |
| 1552 | static_cast<monitor_id_t>(ix), set_option); |
| 1553 | } |
| 1554 | |
| 1555 | /* Currently support 4 operations on the monitor counters: |
| 1556 | turn on, turn off, reset and reset all operations. */ |
| 1557 | switch (set_option) { |
| 1558 | case MONITOR_TURN_ON: |
| 1559 | MONITOR_ON(ix); |
| 1560 | MONITOR_INIT(ix); |
| 1561 | MONITOR_SET_START(ix); |
| 1562 | break; |
| 1563 | |
| 1564 | case MONITOR_TURN_OFF: |
| 1565 | MONITOR_OFF(ix); |
| 1566 | MONITOR_SET_OFF(ix); |
| 1567 | break; |
| 1568 | |
| 1569 | case MONITOR_RESET_VALUE: |
| 1570 | srv_mon_reset(static_cast<monitor_id_t>(ix)); |
| 1571 | break; |
| 1572 | |
| 1573 | case MONITOR_RESET_ALL_VALUE: |
| 1574 | srv_mon_reset_all(static_cast<monitor_id_t>(ix)); |
| 1575 | break; |
| 1576 | |
| 1577 | default: |
| 1578 | ut_error; |
| 1579 | } |
| 1580 | } |
| 1581 | } |
| 1582 | |
| 1583 | /****************************************************************//** |
| 1584 | Get transaction system's rollback segment size in pages |
| 1585 | @return size in pages */ |
| 1586 | static |
| 1587 | ulint |
| 1588 | srv_mon_get_rseg_size(void) |
| 1589 | /*=======================*/ |
| 1590 | { |
| 1591 | ulint i; |
| 1592 | ulint value = 0; |
| 1593 | |
| 1594 | /* rseg_array is a static array, so we can go through it without |
| 1595 | mutex protection. In addition, we provide an estimate of the |
| 1596 | total rollback segment size and to avoid mutex contention we |
| 1597 | don't acquire the rseg->mutex" */ |
| 1598 | for (i = 0; i < TRX_SYS_N_RSEGS; ++i) { |
| 1599 | const trx_rseg_t* rseg = trx_sys.rseg_array[i]; |
| 1600 | |
| 1601 | if (rseg != NULL) { |
| 1602 | value += rseg->curr_size; |
| 1603 | } |
| 1604 | } |
| 1605 | |
| 1606 | return(value); |
| 1607 | } |
| 1608 | |
| 1609 | /****************************************************************//** |
| 1610 | This function consolidates some existing server counters used |
| 1611 | by "system status variables". These existing system variables do not have |
| 1612 | mechanism to start/stop and reset the counters, so we simulate these |
| 1613 | controls by remembering the corresponding counter values when the |
| 1614 | corresponding monitors are turned on/off/reset, and do appropriate |
| 1615 | mathematics to deduct the actual value. Please also refer to |
| 1616 | srv_export_innodb_status() for related global counters used by |
| 1617 | the existing status variables.*/ |
| 1618 | void |
| 1619 | srv_mon_process_existing_counter( |
| 1620 | /*=============================*/ |
| 1621 | monitor_id_t monitor_id, /*!< in: the monitor's ID as in |
| 1622 | monitor_counter_id */ |
| 1623 | mon_option_t set_option) /*!< in: Turn on/off reset the |
| 1624 | counter */ |
| 1625 | { |
| 1626 | mon_type_t value; |
| 1627 | monitor_info_t* monitor_info; |
| 1628 | ibool update_min = FALSE; |
| 1629 | buf_pool_stat_t stat; |
| 1630 | buf_pools_list_size_t buf_pools_list_size; |
| 1631 | ulint LRU_len; |
| 1632 | ulint free_len; |
| 1633 | ulint flush_list_len; |
| 1634 | |
| 1635 | monitor_info = srv_mon_get_info(monitor_id); |
| 1636 | |
| 1637 | ut_a(monitor_info->monitor_type & MONITOR_EXISTING); |
| 1638 | ut_a(monitor_id < NUM_MONITOR); |
| 1639 | |
| 1640 | /* Get the value from corresponding global variable */ |
| 1641 | switch (monitor_id) { |
| 1642 | /* export_vars.innodb_buffer_pool_reads. Num Reads from |
| 1643 | disk (page not in buffer) */ |
| 1644 | case MONITOR_OVLD_BUF_POOL_READS: |
| 1645 | value = srv_stats.buf_pool_reads; |
| 1646 | break; |
| 1647 | |
| 1648 | /* innodb_buffer_pool_read_requests, the number of logical |
| 1649 | read requests */ |
| 1650 | case MONITOR_OVLD_BUF_POOL_READ_REQUESTS: |
| 1651 | buf_get_total_stat(&stat); |
| 1652 | value = stat.n_page_gets; |
| 1653 | break; |
| 1654 | |
| 1655 | /* innodb_buffer_pool_write_requests, the number of |
| 1656 | write request */ |
| 1657 | case MONITOR_OVLD_BUF_POOL_WRITE_REQUEST: |
| 1658 | value = srv_stats.buf_pool_write_requests; |
| 1659 | break; |
| 1660 | |
| 1661 | /* innodb_buffer_pool_wait_free */ |
| 1662 | case MONITOR_OVLD_BUF_POOL_WAIT_FREE: |
| 1663 | value = srv_stats.buf_pool_wait_free; |
| 1664 | break; |
| 1665 | |
| 1666 | /* innodb_buffer_pool_read_ahead */ |
| 1667 | case MONITOR_OVLD_BUF_POOL_READ_AHEAD: |
| 1668 | buf_get_total_stat(&stat); |
| 1669 | value = stat.n_ra_pages_read; |
| 1670 | break; |
| 1671 | |
| 1672 | /* innodb_buffer_pool_read_ahead_evicted */ |
| 1673 | case MONITOR_OVLD_BUF_POOL_READ_AHEAD_EVICTED: |
| 1674 | buf_get_total_stat(&stat); |
| 1675 | value = stat.n_ra_pages_evicted; |
| 1676 | break; |
| 1677 | |
| 1678 | /* innodb_buffer_pool_pages_total */ |
| 1679 | case MONITOR_OVLD_BUF_POOL_PAGE_TOTAL: |
| 1680 | value = buf_pool_get_n_pages(); |
| 1681 | break; |
| 1682 | |
| 1683 | /* innodb_buffer_pool_pages_misc */ |
| 1684 | case MONITOR_OVLD_BUF_POOL_PAGE_MISC: |
| 1685 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); |
| 1686 | value = buf_pool_get_n_pages() - LRU_len - free_len; |
| 1687 | break; |
| 1688 | |
| 1689 | /* innodb_buffer_pool_pages_data */ |
| 1690 | case MONITOR_OVLD_BUF_POOL_PAGES_DATA: |
| 1691 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); |
| 1692 | value = LRU_len; |
| 1693 | break; |
| 1694 | |
| 1695 | /* innodb_buffer_pool_bytes_data */ |
| 1696 | case MONITOR_OVLD_BUF_POOL_BYTES_DATA: |
| 1697 | buf_get_total_list_size_in_bytes(&buf_pools_list_size); |
| 1698 | value = buf_pools_list_size.LRU_bytes |
| 1699 | + buf_pools_list_size.unzip_LRU_bytes; |
| 1700 | break; |
| 1701 | |
| 1702 | /* innodb_buffer_pool_pages_dirty */ |
| 1703 | case MONITOR_OVLD_BUF_POOL_PAGES_DIRTY: |
| 1704 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); |
| 1705 | value = flush_list_len; |
| 1706 | break; |
| 1707 | |
| 1708 | /* innodb_buffer_pool_bytes_dirty */ |
| 1709 | case MONITOR_OVLD_BUF_POOL_BYTES_DIRTY: |
| 1710 | buf_get_total_list_size_in_bytes(&buf_pools_list_size); |
| 1711 | value = buf_pools_list_size.flush_list_bytes; |
| 1712 | break; |
| 1713 | |
| 1714 | /* innodb_buffer_pool_pages_free */ |
| 1715 | case MONITOR_OVLD_BUF_POOL_PAGES_FREE: |
| 1716 | buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len); |
| 1717 | value = free_len; |
| 1718 | break; |
| 1719 | |
| 1720 | /* innodb_pages_created, the number of pages created */ |
| 1721 | case MONITOR_OVLD_PAGE_CREATED: |
| 1722 | buf_get_total_stat(&stat); |
| 1723 | value = stat.n_pages_created; |
| 1724 | break; |
| 1725 | |
| 1726 | /* innodb_pages_written, the number of page written */ |
| 1727 | case MONITOR_OVLD_PAGES_WRITTEN: |
| 1728 | buf_get_total_stat(&stat); |
| 1729 | value = stat.n_pages_written; |
| 1730 | break; |
| 1731 | |
| 1732 | /* innodb_index_pages_written, the number of index pages written */ |
| 1733 | case MONITOR_OVLD_INDEX_PAGES_WRITTEN: |
| 1734 | value = srv_stats.index_pages_written; |
| 1735 | break; |
| 1736 | |
| 1737 | /* innodb_non_index_pages_written, the number of non index pages written */ |
| 1738 | case MONITOR_OVLD_NON_INDEX_PAGES_WRITTEN: |
| 1739 | value = srv_stats.non_index_pages_written; |
| 1740 | break; |
| 1741 | |
| 1742 | /* innodb_pages_read */ |
| 1743 | case MONITOR_OVLD_PAGES_READ: |
| 1744 | buf_get_total_stat(&stat); |
| 1745 | value = stat.n_pages_read; |
| 1746 | break; |
| 1747 | |
| 1748 | /* innodb_pages0_read */ |
| 1749 | case MONITOR_OVLD_PAGES0_READ: |
| 1750 | value = srv_stats.page0_read; |
| 1751 | break; |
| 1752 | |
| 1753 | /* Number of times secondary index lookup triggered cluster lookup */ |
| 1754 | case MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS: |
| 1755 | value = srv_stats.n_sec_rec_cluster_reads; |
| 1756 | break; |
| 1757 | /* Number of times prefix optimization avoided triggering cluster |
| 1758 | lookup */ |
| 1759 | case MONITOR_OVLD_INDEX_SEC_REC_CLUSTER_READS_AVOIDED: |
| 1760 | value = srv_stats.n_sec_rec_cluster_reads_avoided; |
| 1761 | break; |
| 1762 | |
| 1763 | /* innodb_data_reads, the total number of data reads */ |
| 1764 | case MONITOR_OVLD_BYTE_READ: |
| 1765 | value = srv_stats.data_read; |
| 1766 | break; |
| 1767 | |
| 1768 | /* innodb_data_writes, the total number of data writes. */ |
| 1769 | case MONITOR_OVLD_BYTE_WRITTEN: |
| 1770 | value = srv_stats.data_written; |
| 1771 | break; |
| 1772 | |
| 1773 | /* innodb_data_reads, the total number of data reads. */ |
| 1774 | case MONITOR_OVLD_OS_FILE_READ: |
| 1775 | value = os_n_file_reads; |
| 1776 | break; |
| 1777 | |
| 1778 | /* innodb_data_writes, the total number of data writes*/ |
| 1779 | case MONITOR_OVLD_OS_FILE_WRITE: |
| 1780 | value = os_n_file_writes; |
| 1781 | break; |
| 1782 | |
| 1783 | /* innodb_data_fsyncs, number of fsync() operations so far. */ |
| 1784 | case MONITOR_OVLD_OS_FSYNC: |
| 1785 | value = os_n_fsyncs; |
| 1786 | break; |
| 1787 | |
| 1788 | /* innodb_os_log_written */ |
| 1789 | case MONITOR_OVLD_OS_LOG_WRITTEN: |
| 1790 | value = (mon_type_t) srv_stats.os_log_written; |
| 1791 | break; |
| 1792 | |
| 1793 | /* innodb_os_log_fsyncs */ |
| 1794 | case MONITOR_OVLD_OS_LOG_FSYNC: |
| 1795 | value = fil_n_log_flushes; |
| 1796 | break; |
| 1797 | |
| 1798 | /* innodb_os_log_pending_fsyncs */ |
| 1799 | case MONITOR_OVLD_OS_LOG_PENDING_FSYNC: |
| 1800 | value = fil_n_pending_log_flushes; |
| 1801 | update_min = TRUE; |
| 1802 | break; |
| 1803 | |
| 1804 | /* innodb_os_log_pending_writes */ |
| 1805 | case MONITOR_OVLD_OS_LOG_PENDING_WRITES: |
| 1806 | value = srv_stats.os_log_pending_writes; |
| 1807 | update_min = TRUE; |
| 1808 | break; |
| 1809 | |
| 1810 | /* innodb_log_waits */ |
| 1811 | case MONITOR_OVLD_LOG_WAITS: |
| 1812 | value = srv_stats.log_waits; |
| 1813 | break; |
| 1814 | |
| 1815 | /* innodb_log_write_requests */ |
| 1816 | case MONITOR_OVLD_LOG_WRITE_REQUEST: |
| 1817 | value = srv_stats.log_write_requests; |
| 1818 | break; |
| 1819 | |
| 1820 | /* innodb_log_writes */ |
| 1821 | case MONITOR_OVLD_LOG_WRITES: |
| 1822 | value = srv_stats.log_writes; |
| 1823 | break; |
| 1824 | |
| 1825 | case MONITOR_OVLD_LOG_PADDED: |
| 1826 | value = srv_stats.log_padded; |
| 1827 | break; |
| 1828 | |
| 1829 | /* innodb_dblwr_writes */ |
| 1830 | case MONITOR_OVLD_SRV_DBLWR_WRITES: |
| 1831 | value = srv_stats.dblwr_writes; |
| 1832 | break; |
| 1833 | |
| 1834 | /* innodb_dblwr_pages_written */ |
| 1835 | case MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN: |
| 1836 | value = srv_stats.dblwr_pages_written; |
| 1837 | break; |
| 1838 | |
| 1839 | /* innodb_page_size */ |
| 1840 | case MONITOR_OVLD_SRV_PAGE_SIZE: |
| 1841 | value = srv_page_size; |
| 1842 | break; |
| 1843 | |
| 1844 | case MONITOR_OVLD_RWLOCK_S_SPIN_WAITS: |
| 1845 | value = rw_lock_stats.rw_s_spin_wait_count; |
| 1846 | break; |
| 1847 | |
| 1848 | case MONITOR_OVLD_RWLOCK_X_SPIN_WAITS: |
| 1849 | value = rw_lock_stats.rw_x_spin_wait_count; |
| 1850 | break; |
| 1851 | |
| 1852 | case MONITOR_OVLD_RWLOCK_SX_SPIN_WAITS: |
| 1853 | value = rw_lock_stats.rw_sx_spin_wait_count; |
| 1854 | break; |
| 1855 | |
| 1856 | case MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS: |
| 1857 | value = rw_lock_stats.rw_s_spin_round_count; |
| 1858 | break; |
| 1859 | |
| 1860 | case MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS: |
| 1861 | value = rw_lock_stats.rw_x_spin_round_count; |
| 1862 | break; |
| 1863 | |
| 1864 | case MONITOR_OVLD_RWLOCK_SX_SPIN_ROUNDS: |
| 1865 | value = rw_lock_stats.rw_sx_spin_round_count; |
| 1866 | break; |
| 1867 | |
| 1868 | case MONITOR_OVLD_RWLOCK_S_OS_WAITS: |
| 1869 | value = rw_lock_stats.rw_s_os_wait_count; |
| 1870 | break; |
| 1871 | |
| 1872 | case MONITOR_OVLD_RWLOCK_X_OS_WAITS: |
| 1873 | value = rw_lock_stats.rw_x_os_wait_count; |
| 1874 | break; |
| 1875 | |
| 1876 | case MONITOR_OVLD_RWLOCK_SX_OS_WAITS: |
| 1877 | value = rw_lock_stats.rw_sx_os_wait_count; |
| 1878 | break; |
| 1879 | |
| 1880 | case MONITOR_OVLD_BUFFER_POOL_SIZE: |
| 1881 | value = srv_buf_pool_size; |
| 1882 | break; |
| 1883 | |
| 1884 | /* innodb_rows_read */ |
| 1885 | case MONITOR_OLVD_ROW_READ: |
| 1886 | value = srv_stats.n_rows_read; |
| 1887 | break; |
| 1888 | |
| 1889 | /* innodb_rows_inserted */ |
| 1890 | case MONITOR_OLVD_ROW_INSERTED: |
| 1891 | value = srv_stats.n_rows_inserted; |
| 1892 | break; |
| 1893 | |
| 1894 | /* innodb_rows_deleted */ |
| 1895 | case MONITOR_OLVD_ROW_DELETED: |
| 1896 | value = srv_stats.n_rows_deleted; |
| 1897 | break; |
| 1898 | |
| 1899 | /* innodb_rows_updated */ |
| 1900 | case MONITOR_OLVD_ROW_UPDTATED: |
| 1901 | value = srv_stats.n_rows_updated; |
| 1902 | break; |
| 1903 | |
| 1904 | /* innodb_system_rows_read */ |
| 1905 | case MONITOR_OLVD_SYSTEM_ROW_READ: |
| 1906 | value = srv_stats.n_system_rows_read; |
| 1907 | break; |
| 1908 | |
| 1909 | /* innodb_system_rows_inserted */ |
| 1910 | case MONITOR_OLVD_SYSTEM_ROW_INSERTED: |
| 1911 | value = srv_stats.n_system_rows_inserted; |
| 1912 | break; |
| 1913 | |
| 1914 | /* innodb_system_rows_deleted */ |
| 1915 | case MONITOR_OLVD_SYSTEM_ROW_DELETED: |
| 1916 | value = srv_stats.n_system_rows_deleted; |
| 1917 | break; |
| 1918 | |
| 1919 | /* innodb_system_rows_updated */ |
| 1920 | case MONITOR_OLVD_SYSTEM_ROW_UPDATED: |
| 1921 | value = srv_stats.n_system_rows_updated; |
| 1922 | break; |
| 1923 | |
| 1924 | /* innodb_row_lock_current_waits */ |
| 1925 | case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT: |
| 1926 | value = srv_stats.n_lock_wait_current_count; |
| 1927 | break; |
| 1928 | |
| 1929 | /* innodb_row_lock_time */ |
| 1930 | case MONITOR_OVLD_LOCK_WAIT_TIME: |
| 1931 | value = srv_stats.n_lock_wait_time / 1000; |
| 1932 | break; |
| 1933 | |
| 1934 | /* innodb_row_lock_time_max */ |
| 1935 | case MONITOR_OVLD_LOCK_MAX_WAIT_TIME: |
| 1936 | value = lock_sys.n_lock_max_wait_time / 1000; |
| 1937 | break; |
| 1938 | |
| 1939 | /* innodb_row_lock_time_avg */ |
| 1940 | case MONITOR_OVLD_LOCK_AVG_WAIT_TIME: |
| 1941 | if (srv_stats.n_lock_wait_count > 0) { |
| 1942 | value = srv_stats.n_lock_wait_time / 1000 |
| 1943 | / srv_stats.n_lock_wait_count; |
| 1944 | } else { |
| 1945 | value = 0; |
| 1946 | } |
| 1947 | break; |
| 1948 | |
| 1949 | /* innodb_row_lock_waits */ |
| 1950 | case MONITOR_OVLD_ROW_LOCK_WAIT: |
| 1951 | value = srv_stats.n_lock_wait_count; |
| 1952 | break; |
| 1953 | |
| 1954 | case MONITOR_RSEG_HISTORY_LEN: |
| 1955 | value = trx_sys.history_size(); |
| 1956 | break; |
| 1957 | |
| 1958 | case MONITOR_RSEG_CUR_SIZE: |
| 1959 | value = srv_mon_get_rseg_size(); |
| 1960 | break; |
| 1961 | |
| 1962 | case MONITOR_OVLD_N_FILE_OPENED: |
| 1963 | value = fil_n_file_opened; |
| 1964 | break; |
| 1965 | |
| 1966 | case MONITOR_OVLD_IBUF_MERGE_INSERT: |
| 1967 | value = ibuf->n_merged_ops[IBUF_OP_INSERT]; |
| 1968 | break; |
| 1969 | |
| 1970 | case MONITOR_OVLD_IBUF_MERGE_DELETE: |
| 1971 | value = ibuf->n_merged_ops[IBUF_OP_DELETE_MARK]; |
| 1972 | break; |
| 1973 | |
| 1974 | case MONITOR_OVLD_IBUF_MERGE_PURGE: |
| 1975 | value = ibuf->n_merged_ops[IBUF_OP_DELETE]; |
| 1976 | break; |
| 1977 | |
| 1978 | case MONITOR_OVLD_IBUF_MERGE_DISCARD_INSERT: |
| 1979 | value = ibuf->n_discarded_ops[IBUF_OP_INSERT]; |
| 1980 | break; |
| 1981 | |
| 1982 | case MONITOR_OVLD_IBUF_MERGE_DISCARD_DELETE: |
| 1983 | value = ibuf->n_discarded_ops[IBUF_OP_DELETE_MARK]; |
| 1984 | break; |
| 1985 | |
| 1986 | case MONITOR_OVLD_IBUF_MERGE_DISCARD_PURGE: |
| 1987 | value = ibuf->n_discarded_ops[IBUF_OP_DELETE]; |
| 1988 | break; |
| 1989 | |
| 1990 | case MONITOR_OVLD_IBUF_MERGES: |
| 1991 | value = ibuf->n_merges; |
| 1992 | break; |
| 1993 | |
| 1994 | case MONITOR_OVLD_IBUF_SIZE: |
| 1995 | value = ibuf->size; |
| 1996 | break; |
| 1997 | |
| 1998 | case MONITOR_OVLD_SERVER_ACTIVITY: |
| 1999 | value = srv_get_activity_count(); |
| 2000 | break; |
| 2001 | |
| 2002 | case MONITOR_OVLD_LSN_FLUSHDISK: |
| 2003 | value = (mon_type_t) log_sys.flushed_to_disk_lsn; |
| 2004 | break; |
| 2005 | |
| 2006 | case MONITOR_OVLD_LSN_CURRENT: |
| 2007 | value = (mon_type_t) log_sys.lsn; |
| 2008 | break; |
| 2009 | |
| 2010 | case MONITOR_OVLD_BUF_OLDEST_LSN: |
| 2011 | value = (mon_type_t) buf_pool_get_oldest_modification(); |
| 2012 | break; |
| 2013 | |
| 2014 | case MONITOR_OVLD_LSN_CHECKPOINT: |
| 2015 | value = (mon_type_t) log_sys.last_checkpoint_lsn; |
| 2016 | break; |
| 2017 | |
| 2018 | case MONITOR_OVLD_MAX_AGE_ASYNC: |
| 2019 | value = log_sys.max_modified_age_async; |
| 2020 | break; |
| 2021 | |
| 2022 | case MONITOR_OVLD_MAX_AGE_SYNC: |
| 2023 | value = log_sys.max_modified_age_sync; |
| 2024 | break; |
| 2025 | |
| 2026 | #ifdef BTR_CUR_HASH_ADAPT |
| 2027 | case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH: |
| 2028 | value = btr_cur_n_sea; |
| 2029 | break; |
| 2030 | #endif /* BTR_CUR_HASH_ADAPT */ |
| 2031 | |
| 2032 | case MONITOR_OVLD_ADAPTIVE_HASH_SEARCH_BTREE: |
| 2033 | value = btr_cur_n_non_sea; |
| 2034 | break; |
| 2035 | |
| 2036 | case MONITOR_OVLD_PAGE_COMPRESS_SAVED: |
| 2037 | value = srv_stats.page_compression_saved; |
| 2038 | break; |
| 2039 | case MONITOR_OVLD_PAGES_PAGE_COMPRESSED: |
| 2040 | value = srv_stats.pages_page_compressed; |
| 2041 | break; |
| 2042 | case MONITOR_OVLD_PAGE_COMPRESSED_TRIM_OP: |
| 2043 | value = srv_stats.page_compressed_trim_op; |
| 2044 | break; |
| 2045 | case MONITOR_OVLD_PAGES_PAGE_DECOMPRESSED: |
| 2046 | value = srv_stats.pages_page_decompressed; |
| 2047 | break; |
| 2048 | case MONITOR_OVLD_PAGES_PAGE_COMPRESSION_ERROR: |
| 2049 | value = srv_stats.pages_page_compression_error; |
| 2050 | break; |
| 2051 | case MONITOR_OVLD_PAGES_ENCRYPTED: |
| 2052 | value = srv_stats.pages_encrypted; |
| 2053 | break; |
| 2054 | case MONITOR_OVLD_PAGES_DECRYPTED: |
| 2055 | value = srv_stats.pages_decrypted; |
| 2056 | break; |
| 2057 | |
| 2058 | default: |
| 2059 | ut_error; |
| 2060 | } |
| 2061 | |
| 2062 | switch (set_option) { |
| 2063 | case MONITOR_TURN_ON: |
| 2064 | /* Save the initial counter value in mon_start_value |
| 2065 | field */ |
| 2066 | MONITOR_SAVE_START(monitor_id, value); |
| 2067 | return; |
| 2068 | |
| 2069 | case MONITOR_TURN_OFF: |
| 2070 | /* Save the counter value to mon_last_value when we |
| 2071 | turn off the monitor but not yet reset. Note the |
| 2072 | counter has not yet been set to off in the bitmap |
| 2073 | table for normal turn off. We need to check the |
| 2074 | count status (on/off) to avoid reset the value |
| 2075 | for an already off conte */ |
| 2076 | if (MONITOR_IS_ON(monitor_id)) { |
| 2077 | srv_mon_process_existing_counter(monitor_id, |
| 2078 | MONITOR_GET_VALUE); |
| 2079 | MONITOR_SAVE_LAST(monitor_id); |
| 2080 | } |
| 2081 | return; |
| 2082 | |
| 2083 | case MONITOR_GET_VALUE: |
| 2084 | if (MONITOR_IS_ON(monitor_id)) { |
| 2085 | |
| 2086 | /* If MONITOR_DISPLAY_CURRENT bit is on, we |
| 2087 | only record the current value, rather than |
| 2088 | incremental value over a period. Most of |
| 2089 | ` this type of counters are resource related |
| 2090 | counters such as number of buffer pages etc. */ |
| 2091 | if (monitor_info->monitor_type |
| 2092 | & MONITOR_DISPLAY_CURRENT) { |
| 2093 | MONITOR_SET(monitor_id, value); |
| 2094 | } else { |
| 2095 | /* Most status counters are montonically |
| 2096 | increasing, no need to update their |
| 2097 | minimum values. Only do so |
| 2098 | if "update_min" set to TRUE */ |
| 2099 | MONITOR_SET_DIFF(monitor_id, value); |
| 2100 | |
| 2101 | if (update_min |
| 2102 | && (MONITOR_VALUE(monitor_id) |
| 2103 | < MONITOR_MIN_VALUE(monitor_id))) { |
| 2104 | MONITOR_MIN_VALUE(monitor_id) = |
| 2105 | MONITOR_VALUE(monitor_id); |
| 2106 | } |
| 2107 | } |
| 2108 | } |
| 2109 | return; |
| 2110 | |
| 2111 | case MONITOR_RESET_VALUE: |
| 2112 | if (!MONITOR_IS_ON(monitor_id)) { |
| 2113 | MONITOR_LAST_VALUE(monitor_id) = 0; |
| 2114 | } |
| 2115 | return; |
| 2116 | |
| 2117 | /* Nothing special for reset all operation for these existing |
| 2118 | counters */ |
| 2119 | case MONITOR_RESET_ALL_VALUE: |
| 2120 | return; |
| 2121 | } |
| 2122 | } |
| 2123 | |
| 2124 | /*************************************************************//** |
| 2125 | Reset a monitor, create a new base line with the current monitor |
| 2126 | value. This baseline is recorded by MONITOR_VALUE_RESET(monitor) */ |
| 2127 | void |
| 2128 | srv_mon_reset( |
| 2129 | /*==========*/ |
| 2130 | monitor_id_t monitor) /*!< in: monitor id */ |
| 2131 | { |
| 2132 | ibool monitor_was_on; |
| 2133 | |
| 2134 | monitor_was_on = MONITOR_IS_ON(monitor); |
| 2135 | |
| 2136 | if (monitor_was_on) { |
| 2137 | /* Temporarily turn off the counter for the resetting |
| 2138 | operation */ |
| 2139 | MONITOR_OFF(monitor); |
| 2140 | } |
| 2141 | |
| 2142 | /* Before resetting the current monitor value, first |
| 2143 | calculate and set the max/min value since monitor |
| 2144 | start */ |
| 2145 | srv_mon_calc_max_since_start(monitor); |
| 2146 | srv_mon_calc_min_since_start(monitor); |
| 2147 | |
| 2148 | /* Monitors with MONITOR_DISPLAY_CURRENT bit |
| 2149 | are not incremental, no need to remember |
| 2150 | the reset value. */ |
| 2151 | if (innodb_counter_info[monitor].monitor_type |
| 2152 | & MONITOR_DISPLAY_CURRENT) { |
| 2153 | MONITOR_VALUE_RESET(monitor) = 0; |
| 2154 | } else { |
| 2155 | /* Remember the new baseline */ |
| 2156 | MONITOR_VALUE_RESET(monitor) = MONITOR_VALUE_RESET(monitor) |
| 2157 | + MONITOR_VALUE(monitor); |
| 2158 | } |
| 2159 | |
| 2160 | /* Reset the counter value */ |
| 2161 | MONITOR_VALUE(monitor) = 0; |
| 2162 | MONITOR_MAX_VALUE(monitor) = MAX_RESERVED; |
| 2163 | MONITOR_MIN_VALUE(monitor) = MIN_RESERVED; |
| 2164 | |
| 2165 | MONITOR_FIELD((monitor), mon_reset_time) = time(NULL); |
| 2166 | |
| 2167 | if (monitor_was_on) { |
| 2168 | MONITOR_ON(monitor); |
| 2169 | } |
| 2170 | } |
| 2171 | |
| 2172 | /*************************************************************//** |
| 2173 | Turn on monitor counters that are marked as default ON. */ |
| 2174 | void |
| 2175 | srv_mon_default_on(void) |
| 2176 | /*====================*/ |
| 2177 | { |
| 2178 | ulint ix; |
| 2179 | |
| 2180 | for (ix = 0; ix < NUM_MONITOR; ix++) { |
| 2181 | if (innodb_counter_info[ix].monitor_type |
| 2182 | & MONITOR_DEFAULT_ON) { |
| 2183 | /* Turn on monitor counters that are default on */ |
| 2184 | MONITOR_ON(ix); |
| 2185 | MONITOR_INIT(ix); |
| 2186 | MONITOR_SET_START(ix); |
| 2187 | } |
| 2188 | } |
| 2189 | } |
| 2190 | |