summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Lyseng <roy.lyseng@sun.com>2010-03-01 17:31:02 +0100
committerRoy Lyseng <roy.lyseng@sun.com>2010-03-01 17:31:02 +0100
commitb71eb4192c961465872f226d71a5569b2334d369 (patch)
treef9f7d9c57f50ce46409ecddbcdab82c14e18f122
parentde39f438e39214cb43e0bc2a52c2f210c6218bf8 (diff)
downloadmariadb-git-b71eb4192c961465872f226d71a5569b2334d369.tar.gz
WL#5252: Deprecate --optimizer_search_depth=63
Add deprecation warning when variable optimizer_search_depth is given the value 63. mysql-test/r/greedy_optimizer.result Updated with warning text. mysql-test/r/mysqld--help-notwin.result Updated with warning from mysqld --help --verbose. mysql-test/r/mysqld--help-win.result Updated with warning from mysqld --help --verbose. sql/sys_vars.cc Added an update check function to the constructor invocation for the optimizer_search_depth variable. The function emits a warning message for the value 63.
-rw-r--r--mysql-test/r/greedy_optimizer.result2
-rw-r--r--mysql-test/r/mysqld--help-notwin.result5
-rw-r--r--mysql-test/r/mysqld--help-win.result5
-rw-r--r--sql/sys_vars.cc19
4 files changed, 24 insertions, 7 deletions
diff --git a/mysql-test/r/greedy_optimizer.result b/mysql-test/r/greedy_optimizer.result
index c0012c297d1..be4b06396a8 100644
--- a/mysql-test/r/greedy_optimizer.result
+++ b/mysql-test/r/greedy_optimizer.result
@@ -115,6 +115,8 @@ select @@optimizer_prune_level;
@@optimizer_prune_level
1
set optimizer_search_depth=63;
+Warnings:
+Warning 1287 'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
select @@optimizer_search_depth;
@@optimizer_search_depth
63
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index 5c4a13a3c7e..711402c764f 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -396,8 +396,9 @@ The following options may be given as the first argument:
relation result in faster optimization, but may produce
very bad query plans. If set to 0, the system will
automatically pick a reasonable value; if set to 63, the
- optimizer will switch to the original find_best
- search(used for testing/comparison)
+ optimizer will switch to the original find_best search.
+ NOTE: The value 63 and its associated behaviour is
+ deprecated
--optimizer-switch=name
optimizer_switch=option=val[,option=val...], where option
is one of {index_merge, index_merge_union,
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index 15649cbc0fa..9804cfce78b 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -396,8 +396,9 @@ The following options may be given as the first argument:
relation result in faster optimization, but may produce
very bad query plans. If set to 0, the system will
automatically pick a reasonable value; if set to 63, the
- optimizer will switch to the original find_best
- search(used for testing/comparison)
+ optimizer will switch to the original find_best search.
+ NOTE: The value 63 and its associated behaviour is
+ deprecated
--optimizer-switch=name
optimizer_switch=option=val[,option=val...], where option
is one of {index_merge, index_merge_union,
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index b7aa4007153..3de2fd0a985 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1305,6 +1305,17 @@ static Sys_var_ulong Sys_optimizer_prune_level(
SESSION_VAR(optimizer_prune_level), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(0, 1), DEFAULT(1), BLOCK_SIZE(1));
+/** Warns about deprecated value 63 */
+static bool fix_optimizer_search_depth(sys_var *self, THD *thd,
+ enum_var_type type)
+{
+ SV *sv= type == OPT_GLOBAL ? &global_system_variables : &thd->variables;
+ if (sv->optimizer_search_depth == MAX_TABLES+2)
+ WARN_DEPRECATED(thd, 6, 0, "optimizer-search-depth=63",
+ "a search depth less than 63");
+ return false;
+}
+
static Sys_var_ulong Sys_optimizer_search_depth(
"optimizer_search_depth",
"Maximum depth of search performed by the query optimizer. Values "
@@ -1313,10 +1324,12 @@ static Sys_var_ulong Sys_optimizer_search_depth(
"than the number of tables in a relation result in faster "
"optimization, but may produce very bad query plans. If set to 0, "
"the system will automatically pick a reasonable value; if set to "
- "63, the optimizer will switch to the original find_best search"
- "(used for testing/comparison)",
+ "63, the optimizer will switch to the original find_best search. "
+ "NOTE: The value 63 and its associated behaviour is deprecated",
SESSION_VAR(optimizer_search_depth), CMD_LINE(REQUIRED_ARG),
- VALID_RANGE(0, MAX_TABLES+2), DEFAULT(MAX_TABLES+1), BLOCK_SIZE(1));
+ VALID_RANGE(0, MAX_TABLES+2), DEFAULT(MAX_TABLES+1), BLOCK_SIZE(1),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(fix_optimizer_search_depth));
static const char *optimizer_switch_names[]=
{