summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2020-07-02 19:03:39 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2020-07-12 20:03:32 +0530
commit0994af43e582fccf55f7893b16228b57e92330d0 (patch)
tree7d977bcd4d8a7565cc62267ee2862690f17e1063 /sql
parentf81ff93287349daeb62c46e699ac54996a09860b (diff)
downloadmariadb-git-0994af43e582fccf55f7893b16228b57e92330d0.tar.gz
MDEV-22058: Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed in Diagnostics_area::set_ok_status
Error state is not stored in check_and_do_in_subquery_rewrites() when there is illegal combination of optimizer switches. So all the functions eventually return false. Thus the assetion failure.
Diffstat (limited to 'sql')
-rw-r--r--sql/opt_subselect.cc5
-rw-r--r--sql/sys_vars.cc13
2 files changed, 14 insertions, 4 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index 2fb5b88687f..45aa625389d 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -701,9 +701,8 @@ int check_and_do_in_subquery_rewrites(JOIN *join)
{
DBUG_PRINT("info", ("Subquery can't be converted to merged semi-join"));
/* Test if the user has set a legal combination of optimizer switches. */
- if (!optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS) &&
- !optimizer_flag(thd, OPTIMIZER_SWITCH_MATERIALIZATION))
- my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0));
+ DBUG_ASSERT(optimizer_flag(thd, OPTIMIZER_SWITCH_IN_TO_EXISTS |
+ OPTIMIZER_SWITCH_MATERIALIZATION));
/*
Transform each subquery predicate according to its overloaded
transformer.
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 2d40943827f..af261299496 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -2471,12 +2471,23 @@ static bool fix_optimizer_switch(sys_var *self, THD *thd,
"engine_condition_pushdown=on");
return false;
}
+static bool check_legal_optimizer_switch(sys_var *self, THD *thd,
+ set_var *var)
+{
+ if (var->save_result.ulonglong_value & (OPTIMIZER_SWITCH_MATERIALIZATION |
+ OPTIMIZER_SWITCH_IN_TO_EXISTS))
+ {
+ return false;
+ }
+ my_error(ER_ILLEGAL_SUBQUERY_OPTIMIZER_SWITCHES, MYF(0));
+ return true;
+}
static Sys_var_flagset Sys_optimizer_switch(
"optimizer_switch",
"Fine-tune the optimizer behavior",
SESSION_VAR(optimizer_switch), CMD_LINE(REQUIRED_ARG),
optimizer_switch_names, DEFAULT(OPTIMIZER_SWITCH_DEFAULT),
- NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(NULL),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_legal_optimizer_switch),
ON_UPDATE(fix_optimizer_switch));
static Sys_var_charptr Sys_pid_file(