summaryrefslogtreecommitdiff
path: root/sql/sys_vars.cc
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2010-12-03 20:49:08 +0300
committerRamil Kalimullin <ramil@mysql.com>2010-12-03 20:49:08 +0300
commitdb2f37dc31a60fdda020e67d19dda79861adadde (patch)
treef6837ac31a18a3beaceeae63ccda5daa0ba45d7a /sql/sys_vars.cc
parent6929cd95a6bd9fd9a237f4afede02222840f7033 (diff)
downloadmariadb-git-mysql-5.5.8.tar.gz
Fix for bug #58669: read_only not enforced on 5.5.xmysql-5.5.8
Problem: "read-only" option ignored if it's enabled in the command line (or in the config file). Fix: sync opt_readonly (which is used for checks) with read_only (global var) when all server options are handled. mysql-test/r/bug58669.result: Fix for bug #58669: read_only not enforced on 5.5.x - test result. mysql-test/t/bug58669-master.opt: Fix for bug #58669: read_only not enforced on 5.5.x - test case. mysql-test/t/bug58669.test: Fix for bug #58669: read_only not enforced on 5.5.x - test case. sql/mysqld.cc: Fix for bug #58669: read_only not enforced on 5.5.x - sync opt_readonly boolean with read_only boolean in the get_options(). sql/mysqld.h: Fix for bug #58669: read_only not enforced on 5.5.x - sync opt_readonly boolean with read_only boolean in the get_options(). sql/sys_vars.cc: Fix for bug #58669: read_only not enforced on 5.5.x - sync opt_readonly boolean with read_only boolean in the get_options().
Diffstat (limited to 'sql/sys_vars.cc')
-rw-r--r--sql/sys_vars.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 5c9df82ddac..9ca97b5dded 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -1436,7 +1436,6 @@ static Sys_var_ulong Sys_read_buff_size(
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024),
BLOCK_SIZE(IO_SIZE));
-static my_bool read_only;
static bool check_read_only(sys_var *self, THD *thd, set_var *var)
{
/* Prevent self dead-lock */
@@ -1520,6 +1519,16 @@ static bool fix_read_only(sys_var *self, THD *thd, enum_var_type type)
read_only= opt_readonly;
DBUG_RETURN(result);
}
+
+
+/**
+ The read_only boolean is always equal to the opt_readonly boolean except
+ during fix_read_only(); when that function is entered, opt_readonly is
+ the pre-update value and read_only is the post-update value.
+ fix_read_only() compares them and runs needed operations for the
+ transition (especially when transitioning from false to true) and
+ synchronizes both booleans in the end.
+*/
static Sys_var_mybool Sys_readonly(
"read_only",
"Make all non-temporary tables read-only, with the exception for "