Commit 3602e293 authored by unknown's avatar unknown

Bug #26598: Create variable to allow turning off of statistic gathering on metadata commands

Add innodb_stats_on_metadata option, which enables gathering
index statistics when processing metadata commands such as
SHOW TABLE STATUS.  Default behavior of the server does not
change (this option is enabled by default).


sql/mysqld.cc:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
sql/set_var.cc:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
storage/innobase/handler/ha_innodb.cc:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
storage/innobase/handler/ha_innodb.h:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
storage/innobase/include/srv0srv.h:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
storage/innobase/srv/srv0srv.c:
  Add innodb_stats_on_metadata option, which enables gathering
  index statistics when processing metadata commands such as
  SHOW TABLE STATUS.  Default behavior of the server does not
  change (this option is enabled by default).
parent feff0058
......@@ -399,6 +399,7 @@ extern my_bool innobase_log_archive,
innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout,
innobase_stats_on_metadata,
innobase_create_status_file;
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
......@@ -4966,6 +4967,7 @@ enum options_mysqld
OPT_INNODB_SYNC_SPIN_LOOPS,
OPT_INNODB_CONCURRENCY_TICKETS,
OPT_INNODB_THREAD_SLEEP_DELAY,
OPT_INNODB_STATS_ON_METADATA,
OPT_BDB_CACHE_SIZE,
OPT_BDB_CACHE_PARTS,
OPT_BDB_LOG_BUFFER_SIZE,
......@@ -5311,6 +5313,10 @@ Disable with --skip-innodb-doublewrite.", (gptr*) &innobase_use_doublewrite,
"Enable SHOW INNODB STATUS output in the innodb_status.<pid> file",
(gptr*) &innobase_create_status_file, (gptr*) &innobase_create_status_file,
0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_stats_on_metadata", OPT_INNODB_STATS_ON_METADATA,
"Enable statistics gathering for metadata commands such as SHOW TABLE STATUS (on by default)",
(gptr*) &innobase_stats_on_metadata, (gptr*) &innobase_stats_on_metadata,
0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"innodb_support_xa", OPT_INNODB_SUPPORT_XA,
"Enable InnoDB support for the XA two-phase commit",
(gptr*) &global_system_variables.innodb_support_xa,
......@@ -8348,7 +8354,8 @@ my_bool innobase_log_archive,
innobase_use_checksums,
innobase_file_per_table,
innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout;
innobase_rollback_on_timeout,
innobase_stats_on_metadata;
extern "C" {
ulong srv_max_buf_pool_modified_pct;
......
......@@ -78,7 +78,8 @@ extern my_bool innobase_log_archive,
innobase_use_checksums,
innobase_file_per_table,
innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout;
innobase_rollback_on_timeout,
innobase_stats_on_metadata;
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
......@@ -835,6 +836,7 @@ SHOW_VAR init_vars[]= {
{"innodb_mirrored_log_groups", (char*) &innobase_mirrored_log_groups, SHOW_LONG},
{"innodb_open_files", (char*) &innobase_open_files, SHOW_LONG },
{"innodb_rollback_on_timeout", (char*) &innobase_rollback_on_timeout, SHOW_MY_BOOL},
{"innodb_stats_on_metadata", (char*) &innobase_stats_on_metadata, SHOW_MY_BOOL},
{sys_innodb_support_xa.name, (char*) &sys_innodb_support_xa, SHOW_SYS},
{sys_innodb_sync_spin_loops.name, (char*) &sys_innodb_sync_spin_loops, SHOW_SYS},
{sys_innodb_table_locks.name, (char*) &sys_innodb_table_locks, SHOW_SYS},
......
......@@ -179,6 +179,7 @@ my_bool innobase_file_per_table = FALSE;
my_bool innobase_locks_unsafe_for_binlog = FALSE;
my_bool innobase_rollback_on_timeout = FALSE;
my_bool innobase_create_status_file = FALSE;
my_bool innobase_stats_on_metadata = TRUE;
static char *internal_innobase_data_file_path = NULL;
......@@ -1564,6 +1565,8 @@ innobase_init(void *p)
srv_max_n_open_files = (ulint) innobase_open_files;
srv_innodb_status = (ibool) innobase_create_status_file;
srv_stats_on_metadata = (ibool) innobase_stats_on_metadata;
srv_print_verbose_log = mysqld_embedded ? 0 : 1;
/* Store the default charset-collation number of this MySQL
......@@ -5522,6 +5525,7 @@ ha_innobase::info(
ib_table = prebuilt->table;
if (flag & HA_STATUS_TIME) {
if (srv_stats_on_metadata) {
/* In sql_show we call with this flag: update then statistics
so that they are up-to-date */
......@@ -5531,6 +5535,7 @@ ha_innobase::info(
prebuilt->trx->op_info = (char*)
"returning various info to MySQL";
}
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name, reg_ext);
......
......@@ -224,7 +224,8 @@ extern my_bool innobase_log_archive,
innobase_use_native_aio,
innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_rollback_on_timeout,
innobase_create_status_file;
innobase_create_status_file,
innobase_stats_on_metadata;
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
......
......@@ -124,6 +124,8 @@ extern ulint srv_fast_shutdown; /* If this is 1, do not do a
transactions). */
extern ibool srv_innodb_status;
extern ibool srv_stats_on_metadata;
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
......
......@@ -317,6 +317,8 @@ ulint srv_fast_shutdown = 0;
/* Generate a innodb_status.<pid> file */
ibool srv_innodb_status = FALSE;
ibool srv_stats_on_metadata = TRUE;
ibool srv_use_doublewrite_buf = TRUE;
ibool srv_use_checksums = TRUE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment