summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-05-08 16:42:55 -0700
committerIgor Babaev <igor@askmonty.org>2012-05-08 16:42:55 -0700
commit2a1afc29f252fb189f6e93a2e0d3a1939f8220d5 (patch)
tree66df935533dfe35df5603e3ccd04e29919cc66ce
parent906c9a93a0da7df1e27d776d561c84c48ce7ee6d (diff)
downloadmariadb-git-2a1afc29f252fb189f6e93a2e0d3a1939f8220d5.tar.gz
Inverted the option --skip-stat-tables for --stat-tables.
Set it to 0 by default. Now only the tests that use persistent statistics tables require starting the server with --stat-tables set on.
-rw-r--r--mysql-test/include/have_stat_tables.inc5
-rw-r--r--mysql-test/include/have_stat_tables.opt1
-rw-r--r--mysql-test/r/mysqld--help.result8
-rw-r--r--mysql-test/t/stat_tables.test1
-rw-r--r--mysql-test/t/statistics.test1
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/mysqld.h4
-rw-r--r--sql/sql_admin.cc2
-rw-r--r--sql/sql_base.cc2
9 files changed, 22 insertions, 14 deletions
diff --git a/mysql-test/include/have_stat_tables.inc b/mysql-test/include/have_stat_tables.inc
new file mode 100644
index 00000000000..97d0e44e39e
--- /dev/null
+++ b/mysql-test/include/have_stat_tables.inc
@@ -0,0 +1,5 @@
+if (`select count(*) < 3 from information_schema.tables
+ where table_schema = 'mysql' and table_name in ('table_stat','column_stat','index_stat')`)
+{
+ --skip Needs stat tables
+}
diff --git a/mysql-test/include/have_stat_tables.opt b/mysql-test/include/have_stat_tables.opt
new file mode 100644
index 00000000000..eb8f2d54ff6
--- /dev/null
+++ b/mysql-test/include/have_stat_tables.opt
@@ -0,0 +1 @@
+--stat-tables
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 6b8ff4e5471..83fb6b566e2 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -720,9 +720,6 @@ The following options may be given as the first argument:
--skip-show-database
Don't allow 'SHOW DATABASE' commands
--skip-slave-start If set, slave is not autostarted.
- --skip-stat-tables Start without statistical tables. Statistical data on
- table cardinalities, columns and indexes from these
- tables become unavailable
--skip-thread-priority
Don't give threads different priorities. This option is
deprecated because it has no effect; the implied behavior
@@ -781,6 +778,9 @@ The following options may be given as the first argument:
for the complete list of valid sql modes
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
+ --stat-tables Start with statistical tables. Statistical data on table
+ cardinalities, columns and indexes from these tables
+ become available
--stored-program-cache=#
The soft upper limit for number of cached stored routines
for one connection.
@@ -1057,7 +1057,6 @@ skip-name-resolve FALSE
skip-networking FALSE
skip-show-database FALSE
skip-slave-start FALSE
-skip-stat-tables TRUE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
slave-net-timeout 3600
@@ -1070,6 +1069,7 @@ slow-query-log FALSE
sort-buffer-size 2097152
sql-mode
stack-trace TRUE
+stat-tables FALSE
stored-program-cache 256
symbolic-links FALSE
sync-binlog 0
diff --git a/mysql-test/t/stat_tables.test b/mysql-test/t/stat_tables.test
index aecb43fe763..47ec0696552 100644
--- a/mysql-test/t/stat_tables.test
+++ b/mysql-test/t/stat_tables.test
@@ -1,3 +1,4 @@
+--source include/have_stat_tables.inc
set @save_optimizer_use_stat_tables=@@optimizer_use_stat_tables;
diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test
index 81108c9846d..7d1b207689c 100644
--- a/mysql-test/t/statistics.test
+++ b/mysql-test/t/statistics.test
@@ -1,3 +1,4 @@
+--source include/have_stat_tables.inc
--source include/have_innodb.inc
--disable_warnings
drop table if exists t1,t2;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 7b7c73f147c..5da2bac74e3 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -446,7 +446,7 @@ ulong opt_replicate_events_marked_for_skip;
*/
volatile bool mqh_used = 0;
my_bool opt_noacl;
-my_bool opt_no_stat_tables;
+my_bool opt_with_stat_tables;
my_bool sp_automatic_privileges= 1;
ulong opt_binlog_rows_event_max_size;
@@ -6384,10 +6384,10 @@ struct my_option my_long_options[]=
&opt_noacl, &opt_noacl, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
#endif
- {"skip-stat-tables", OPT_SKIP_STAT_TABLES,
- "Start without statistical tables. Statistical data on table cardinalities, "
- "columns and indexes from these tables become unavailable",
- &opt_no_stat_tables, &opt_no_stat_tables, 0, GET_BOOL, NO_ARG,
+ {"stat-tables", OPT_WITH_STAT_TABLES,
+ "Start with statistical tables. Statistical data on table cardinalities, "
+ "columns and indexes from these tables become available",
+ &opt_with_stat_tables, &opt_with_stat_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"skip-host-cache", OPT_SKIP_HOST_CACHE, "Don't cache host names.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -7656,7 +7656,7 @@ mysqld_get_one_option(int optid,
break;
case OPT_BOOTSTRAP:
opt_noacl=opt_bootstrap=1;
- opt_no_stat_tables= 1;
+ opt_with_stat_tables= 0;
break;
case OPT_SERVER_ID:
server_id_supplied = 1;
diff --git a/sql/mysqld.h b/sql/mysqld.h
index 6d2da80d7c8..35b395667e3 100644
--- a/sql/mysqld.h
+++ b/sql/mysqld.h
@@ -105,7 +105,7 @@ extern char* opt_secure_backup_file_priv;
extern size_t opt_secure_backup_file_priv_len;
extern my_bool opt_log_slow_admin_statements, opt_log_slow_slave_statements;
extern my_bool sp_automatic_privileges, opt_noacl;
-extern my_bool opt_no_stat_tables;
+extern my_bool opt_with_stat_tables;
extern my_bool opt_old_style_user_limits, trust_function_creators;
extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port;
@@ -396,7 +396,7 @@ enum options_mysqld
OPT_SKIP_PRIOR,
OPT_SKIP_RESOLVE,
OPT_SKIP_STACK_TRACE,
- OPT_SKIP_STAT_TABLES,
+ OPT_WITH_STAT_TABLES,
OPT_SKIP_SYMLINKS,
OPT_SLOW_QUERY_LOG,
OPT_SSL_CA,
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index 46637bf10a4..c2d06a149e8 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -637,7 +637,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
DBUG_PRINT("admin", ("operator_func returned: %d", result_code));
}
- if (operator_func == &handler::ha_analyze && !opt_no_stat_tables &&
+ if (operator_func == &handler::ha_analyze && opt_with_stat_tables &&
thd->variables.optimizer_use_stat_tables > 0)
{
if (!(compl_result_code=
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 62db3b2e823..e1967c35031 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4625,7 +4625,7 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables,
goto end;
}
- if (!opt_no_stat_tables && thd->variables.optimizer_use_stat_tables > 0)
+ if (opt_with_stat_tables && thd->variables.optimizer_use_stat_tables > 0)
{
if (tables->table && tables->table->s &&
tables->table->s->table_category != TABLE_CATEGORY_SYSTEM)