Skip to content

Commit afadc5c

Browse files
author
Sai Tharun Ambati
committed
Bug#35308309 : Prepare exec invalid variable assertion error
Description: ------------ Server exits abruptly when we try to set the read only variable INNODB_PURGE_THREADS. Analysis: --------- While setting a read-only variable using the SET command, mysqld checks if the variable is read only and then errors out with a proper error message. This is missing when we set the same read only variable using PREPARED STATEMENTS. So, the INNODB_PURGE_THREADS is successfully modified and it leads to this unexpected behaviour. Fix: ---- Added the check to error out from setting the read only variables when it is from PREPARED STATEMENT. Change-Id: I4a41ab4ae42d6e5867ef383671e9444cb044da8f
1 parent 29ca8dc commit afadc5c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sql/set_var.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,19 @@ int set_var::check(THD *thd) {
16671667
}
16681668

16691669
auto f = [this, thd](const System_variable_tracker &, sys_var *var) -> int {
1670+
if (var->is_readonly()) {
1671+
if (type != OPT_PERSIST_ONLY) {
1672+
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str,
1673+
"read only");
1674+
return -1;
1675+
}
1676+
if (type == OPT_PERSIST_ONLY && var->is_non_persistent() &&
1677+
!can_persist_non_persistent_var(thd, var, type)) {
1678+
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str,
1679+
"non persistent read only");
1680+
return -1;
1681+
}
1682+
}
16701683
if (var->check_update_type(value->result_type())) {
16711684
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name.str);
16721685
return -1;

0 commit comments

Comments
 (0)