Skip to content

Commit 4840244

Browse files
Sai Tharun Ambatidahlerlend
Sai Tharun Ambati
authored andcommitted
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 fc84086 commit 4840244

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
@@ -1750,6 +1750,19 @@ int set_var::check(THD *thd) {
17501750
}
17511751

17521752
auto f = [this, thd](const System_variable_tracker &, sys_var *var) -> int {
1753+
if (var->is_readonly()) {
1754+
if (type != OPT_PERSIST_ONLY) {
1755+
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str,
1756+
"read only");
1757+
return -1;
1758+
}
1759+
if (type == OPT_PERSIST_ONLY && var->is_non_persistent() &&
1760+
!can_persist_non_persistent_var(thd, var, type)) {
1761+
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0), var->name.str,
1762+
"non persistent read only");
1763+
return -1;
1764+
}
1765+
}
17531766
if (var->check_update_type(value->result_type())) {
17541767
my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name.str);
17551768
return -1;

0 commit comments

Comments
 (0)