summaryrefslogtreecommitdiff
path: root/storage/innobase/srv/srv0mon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/srv/srv0mon.cc')
-rw-r--r--storage/innobase/srv/srv0mon.cc221
1 files changed, 147 insertions, 74 deletions
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 9c6e56bcb9d..3b3da2f070f 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
-Copyright (c) 2010, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2010, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -33,7 +34,6 @@ Created 12/9/2009 Jimmy Yang
#include "trx0rseg.h"
#include "lock0lock.h"
#include "ibuf0ibuf.h"
-#include "btr0cur.h"
#ifdef UNIV_NONINL
#include "srv0mon.ic"
#endif
@@ -215,11 +215,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_WRITE_REQUEST},
- {"buffer_pool_pages_in_flush", "buffer",
- "Number of pages in flush list",
- MONITOR_NONE,
- MONITOR_DEFAULT_START, MONITOR_PAGE_INFLUSH},
-
{"buffer_pool_wait_free", "buffer",
"Number of times waited for free buffer"
" (innodb_buffer_pool_wait_free)",
@@ -259,12 +254,24 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DATA},
+ {"buffer_pool_bytes_data", "buffer",
+ "Buffer bytes containing data (innodb_buffer_pool_bytes_data)",
+ static_cast<monitor_type_t>(
+ MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
+ MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DATA},
+
{"buffer_pool_pages_dirty", "buffer",
"Buffer pages currently dirty (innodb_buffer_pool_pages_dirty)",
static_cast<monitor_type_t>(
MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_PAGES_DIRTY},
+ {"buffer_pool_bytes_dirty", "buffer",
+ "Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty)",
+ static_cast<monitor_type_t>(
+ MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT | MONITOR_DEFAULT_ON),
+ MONITOR_DEFAULT_START, MONITOR_OVLD_BUF_POOL_BYTES_DIRTY},
+
{"buffer_pool_pages_free", "buffer",
"Buffer pages currently free (innodb_buffer_pool_pages_free)",
static_cast<monitor_type_t>(
@@ -350,25 +357,40 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_SET_MEMBER, MONITOR_FLUSH_NEIGHBOR_TOTAL_PAGE,
MONITOR_FLUSH_NEIGHBOR_PAGES},
- /* Cumulative counter for flush batches because of max_dirty */
- {"buffer_flush_max_dirty_total_pages", "buffer",
- "Total pages flushed as part of max_dirty batches",
- MONITOR_SET_OWNER, MONITOR_FLUSH_MAX_DIRTY_COUNT,
- MONITOR_FLUSH_MAX_DIRTY_TOTAL_PAGE},
+ {"buffer_flush_n_to_flush_requested", "buffer",
+ "Number of pages requested for flushing.",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_N_TO_FLUSH_REQUESTED},
+
+ {"buffer_flush_avg_page_rate", "buffer",
+ "Average number of pages at which flushing is happening",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_PAGE_RATE},
+
+ {"buffer_flush_lsn_avg_rate", "buffer",
+ "Average redo generation rate",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_LSN_AVG_RATE},
+
+ {"buffer_flush_pct_for_dirty", "buffer",
+ "Percent of IO capacity used to avoid max dirty page limit",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_DIRTY},
- {"buffer_flush_max_dirty", "buffer",
- "Number of max_dirty batches",
- MONITOR_SET_MEMBER, MONITOR_FLUSH_MAX_DIRTY_TOTAL_PAGE,
- MONITOR_FLUSH_MAX_DIRTY_COUNT},
+ {"buffer_flush_pct_for_lsn", "buffer",
+ "Percent of IO capacity used to avoid reusable redo space limit",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_PCT_FOR_LSN},
+
+ {"buffer_flush_sync_waits", "buffer",
+ "Number of times a wait happens due to sync flushing",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_FLUSH_SYNC_WAITS},
- {"buffer_flush_max_dirty_pages", "buffer",
- "Pages queued as a max_dirty batch",
- MONITOR_SET_MEMBER, MONITOR_FLUSH_MAX_DIRTY_TOTAL_PAGE,
- MONITOR_FLUSH_MAX_DIRTY_PAGES},
- /* Cumulative counter for flush batches because of adaptive */
+ /* Cumulative counter for flush batches for adaptive flushing */
{"buffer_flush_adaptive_total_pages", "buffer",
- "Total pages flushed as part of adaptive batches",
+ "Total pages flushed as part of adaptive flushing",
MONITOR_SET_OWNER, MONITOR_FLUSH_ADAPTIVE_COUNT,
MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE},
@@ -382,22 +404,6 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_SET_MEMBER, MONITOR_FLUSH_ADAPTIVE_TOTAL_PAGE,
MONITOR_FLUSH_ADAPTIVE_PAGES},
- /* Cumulative counter for flush batches because of async */
- {"buffer_flush_async_total_pages", "buffer",
- "Total pages flushed as part of async batches",
- MONITOR_SET_OWNER, MONITOR_FLUSH_ASYNC_COUNT,
- MONITOR_FLUSH_ASYNC_TOTAL_PAGE},
-
- {"buffer_flush_async", "buffer",
- "Number of async batches",
- MONITOR_SET_MEMBER, MONITOR_FLUSH_ASYNC_TOTAL_PAGE,
- MONITOR_FLUSH_ASYNC_COUNT},
-
- {"buffer_flush_async_pages", "buffer",
- "Pages queued as an async batch",
- MONITOR_SET_MEMBER, MONITOR_FLUSH_ASYNC_TOTAL_PAGE,
- MONITOR_FLUSH_ASYNC_PAGES},
-
/* Cumulative counter for flush batches because of sync */
{"buffer_flush_sync_total_pages", "buffer",
"Total pages flushed as part of sync batches",
@@ -859,6 +865,16 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_PAGE_DECOMPRESS},
+ {"compression_pad_increments", "compression",
+ "Number of times padding is incremented to avoid compression failures",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_PAD_INCREMENTS},
+
+ {"compression_pad_decrements", "compression",
+ "Number of times padding is decremented due to good compressibility",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_PAD_DECREMENTS},
+
/* ========== Counters for Index ========== */
{"module_index", "index", "Index Manager",
MONITOR_MODULE,
@@ -1130,11 +1146,26 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_MODULE,
MONITOR_DEFAULT_START, MONITOR_MODULE_DDL_STATS},
+ {"ddl_background_drop_indexes", "ddl",
+ "Number of indexes waiting to be dropped after failed index creation",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_INDEX},
+
{"ddl_background_drop_tables", "ddl",
"Number of tables in background drop table list",
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_BACKGROUND_DROP_TABLE},
+ {"ddl_online_create_index", "ddl",
+ "Number of indexes being created online",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_ONLINE_CREATE_INDEX},
+
+ {"ddl_pending_alter_table", "ddl",
+ "Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress",
+ MONITOR_NONE,
+ MONITOR_DEFAULT_START, MONITOR_PENDING_ALTER_TABLE},
+
/* ===== Counters for ICP (Index Condition Pushdown) Module ===== */
{"module_icp", "icp", "Index Condition Pushdown",
MONITOR_MODULE,
@@ -1171,6 +1202,34 @@ has been turned on/off. */
UNIV_INTERN ulint monitor_set_tbl[(NUM_MONITOR + NUM_BITS_ULINT
- 1) / NUM_BITS_ULINT];
+#ifndef HAVE_ATOMIC_BUILTINS_64
+/** Mutex protecting atomic operations on platforms that lack
+built-in operations for atomic memory access */
+ib_mutex_t monitor_mutex;
+
+/** Key to register monitor_mutex with performance schema */
+UNIV_INTERN mysql_pfs_key_t monitor_mutex_key;
+
+/****************************************************************//**
+Initialize the monitor subsystem. */
+UNIV_INTERN
+void
+srv_mon_create(void)
+/*================*/
+{
+ mutex_create(monitor_mutex_key, &monitor_mutex, SYNC_ANY_LATCH);
+}
+/****************************************************************//**
+Close the monitor subsystem. */
+UNIV_INTERN
+void
+srv_mon_free(void)
+/*==============*/
+{
+ mutex_free(&monitor_mutex);
+}
+#endif /* !HAVE_ATOMIC_BUILTINS_64 */
+
/****************************************************************//**
Get a monitor's "monitor_info" by its monitor id (index into the
innodb_counter_info array.
@@ -1359,13 +1418,14 @@ srv_mon_process_existing_counter(
mon_option_t set_option) /*!< in: Turn on/off reset the
counter */
{
- mon_type_t value;
- monitor_info_t* monitor_info;
- ibool update_min = FALSE;
- buf_pool_stat_t stat;
- ulint LRU_len;
- ulint free_len;
- ulint flush_list_len;
+ mon_type_t value;
+ monitor_info_t* monitor_info;
+ ibool update_min = FALSE;
+ buf_pool_stat_t stat;
+ buf_pools_list_size_t buf_pools_list_size;
+ ulint LRU_len;
+ ulint free_len;
+ ulint flush_list_len;
monitor_info = srv_mon_get_info(monitor_id);
@@ -1381,7 +1441,7 @@ srv_mon_process_existing_counter(
/* export_vars.innodb_buffer_pool_reads. Num Reads from
disk (page not in buffer) */
case MONITOR_OVLD_BUF_POOL_READS:
- value = srv_buf_pool_reads;
+ value = srv_stats.buf_pool_reads;
break;
/* innodb_buffer_pool_read_requests, the number of logical
@@ -1394,12 +1454,12 @@ srv_mon_process_existing_counter(
/* innodb_buffer_pool_write_requests, the number of
write request */
case MONITOR_OVLD_BUF_POOL_WRITE_REQUEST:
- value = srv_buf_pool_write_requests;
+ value = srv_stats.buf_pool_write_requests;
break;
/* innodb_buffer_pool_wait_free */
case MONITOR_OVLD_BUF_POOL_WAIT_FREE:
- value = srv_buf_pool_wait_free;
+ value = srv_stats.buf_pool_wait_free;
break;
/* innodb_buffer_pool_read_ahead */
@@ -1431,12 +1491,25 @@ srv_mon_process_existing_counter(
value = LRU_len;
break;
+ /* innodb_buffer_pool_bytes_data */
+ case MONITOR_OVLD_BUF_POOL_BYTES_DATA:
+ buf_get_total_list_size_in_bytes(&buf_pools_list_size);
+ value = buf_pools_list_size.LRU_bytes
+ + buf_pools_list_size.unzip_LRU_bytes;
+ break;
+
/* innodb_buffer_pool_pages_dirty */
case MONITOR_OVLD_BUF_POOL_PAGES_DIRTY:
buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
value = flush_list_len;
break;
+ /* innodb_buffer_pool_bytes_dirty */
+ case MONITOR_OVLD_BUF_POOL_BYTES_DIRTY:
+ buf_get_total_list_size_in_bytes(&buf_pools_list_size);
+ value = buf_pools_list_size.flush_list_bytes;
+ break;
+
/* innodb_buffer_pool_pages_free */
case MONITOR_OVLD_BUF_POOL_PAGES_FREE:
buf_get_total_list_len(&LRU_len, &free_len, &flush_list_len);
@@ -1463,12 +1536,12 @@ srv_mon_process_existing_counter(
/* innodb_data_reads, the total number of data reads */
case MONITOR_OVLD_BYTE_READ:
- value = srv_data_read;
+ value = srv_stats.data_read;
break;
/* innodb_data_writes, the total number of data writes. */
case MONITOR_OVLD_BYTE_WRITTEN:
- value = srv_data_written;
+ value = srv_stats.data_written;
break;
/* innodb_data_reads, the total number of data reads. */
@@ -1488,7 +1561,7 @@ srv_mon_process_existing_counter(
/* innodb_os_log_written */
case MONITOR_OVLD_OS_LOG_WRITTEN:
- value = (mon_type_t) srv_os_log_written;
+ value = (mon_type_t) srv_stats.os_log_written;
break;
/* innodb_os_log_fsyncs */
@@ -1504,33 +1577,33 @@ srv_mon_process_existing_counter(
/* innodb_os_log_pending_writes */
case MONITOR_OVLD_OS_LOG_PENDING_WRITES:
- value = srv_os_log_pending_writes;
+ value = srv_stats.os_log_pending_writes;
update_min = TRUE;
break;
/* innodb_log_waits */
case MONITOR_OVLD_LOG_WAITS:
- value = srv_log_waits;
+ value = srv_stats.log_waits;
break;
/* innodb_log_write_requests */
case MONITOR_OVLD_LOG_WRITE_REQUEST:
- value = srv_log_write_requests;
+ value = srv_stats.log_write_requests;
break;
/* innodb_log_writes */
case MONITOR_OVLD_LOG_WRITES:
- value = srv_log_writes;
+ value = srv_stats.log_writes;
break;
/* innodb_dblwr_writes */
case MONITOR_OVLD_SRV_DBLWR_WRITES:
- value = srv_dblwr_writes;
+ value = srv_stats.dblwr_writes;
break;
/* innodb_dblwr_pages_written */
case MONITOR_OVLD_SRV_DBLWR_PAGES_WRITTEN:
- value = srv_dblwr_pages_written;
+ value = srv_stats.dblwr_pages_written;
break;
/* innodb_page_size */
@@ -1539,27 +1612,27 @@ srv_mon_process_existing_counter(
break;
case MONITOR_OVLD_RWLOCK_S_SPIN_WAITS:
- value = rw_s_spin_wait_count;
+ value = rw_lock_stats.rw_s_spin_wait_count;
break;
case MONITOR_OVLD_RWLOCK_X_SPIN_WAITS:
- value = rw_x_os_wait_count;
+ value = rw_lock_stats.rw_x_os_wait_count;
break;
case MONITOR_OVLD_RWLOCK_S_SPIN_ROUNDS:
- value = rw_s_spin_round_count;
+ value = rw_lock_stats.rw_s_spin_round_count;
break;
case MONITOR_OVLD_RWLOCK_X_SPIN_ROUNDS:
- value = rw_x_spin_round_count;
+ value = rw_lock_stats.rw_x_spin_round_count;
break;
case MONITOR_OVLD_RWLOCK_S_OS_WAITS:
- value = rw_s_os_wait_count;
+ value = rw_lock_stats.rw_s_os_wait_count;
break;
case MONITOR_OVLD_RWLOCK_X_OS_WAITS:
- value = rw_x_os_wait_count;
+ value = rw_lock_stats.rw_x_os_wait_count;
break;
case MONITOR_OVLD_BUFFER_POOL_SIZE:
@@ -1568,44 +1641,44 @@ srv_mon_process_existing_counter(
/* innodb_rows_read */
case MONITOR_OLVD_ROW_READ:
- value = srv_n_rows_read;
+ value = srv_stats.n_rows_read;
break;
/* innodb_rows_inserted */
case MONITOR_OLVD_ROW_INSERTED:
- value = srv_n_rows_inserted;
+ value = srv_stats.n_rows_inserted;
break;
/* innodb_rows_deleted */
case MONITOR_OLVD_ROW_DELETED:
- value = srv_n_rows_deleted;
+ value = srv_stats.n_rows_deleted;
break;
/* innodb_rows_updated */
case MONITOR_OLVD_ROW_UPDTATED:
- value = srv_n_rows_updated;
+ value = srv_stats.n_rows_updated;
break;
/* innodb_row_lock_current_waits */
case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT:
- value = srv_n_lock_wait_current_count;
+ value = srv_stats.n_lock_wait_current_count;
break;
/* innodb_row_lock_time */
case MONITOR_OVLD_LOCK_WAIT_TIME:
- value = srv_n_lock_wait_time / 1000;
+ value = srv_stats.n_lock_wait_time / 1000;
break;
/* innodb_row_lock_time_max */
case MONITOR_OVLD_LOCK_MAX_WAIT_TIME:
- value = srv_n_lock_max_wait_time / 1000;
+ value = lock_sys->n_lock_max_wait_time / 1000;
break;
/* innodb_row_lock_time_avg */
case MONITOR_OVLD_LOCK_AVG_WAIT_TIME:
- if (srv_n_lock_wait_count > 0) {
- value = srv_n_lock_wait_time / 1000
- / srv_n_lock_wait_count;
+ if (srv_stats.n_lock_wait_count > 0) {
+ value = srv_stats.n_lock_wait_time / 1000
+ / srv_stats.n_lock_wait_count;
} else {
value = 0;
}
@@ -1613,7 +1686,7 @@ srv_mon_process_existing_counter(
/* innodb_row_lock_waits */
case MONITOR_OVLD_ROW_LOCK_WAIT:
- value = srv_n_lock_wait_count;
+ value = srv_stats.n_lock_wait_count;
break;
case MONITOR_RSEG_HISTORY_LEN: