Below is the list of changes that have just been committed into a local
5.1 repository of kaa. When kaa does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-23 18:20:12+04:00, kaa@polly.(none) +3 -0
Fix for bug #29131: SHOW VARIABLES reports variable 'log' but SET
doesn't recognize it
This is a 5.1 version of the patch.
Problem:
'log' was a "fixed" variable, i.e. it showed up in SHOW VARIABLES, but
could not be used in expressions like "select @@log". Also, using it in
the SET statement produced an incorrect "unknown system variable" error.
Solution:
Since as of MySQL 5.1.12 one can enable or disable the general query log
at runtime by changing the value of the 'general_log' system variable,
make 'log' to be a synonym for 'general_log'. This makes expressions
using the '@@log' syntax backward compatible with 5.0 and SHOW VARIABLES
to be consistent with the SET statement.
mysql-test/r/variables.result@stripped, 2007-10-23 18:20:05+04:00, kaa@polly.(none) +30 -0
Added a test case for bug #29131.
mysql-test/t/variables.test@stripped, 2007-10-23 18:20:05+04:00, kaa@polly.(none) +18 -0
Added a test case for bug #29131.
sql/set_var.cc@stripped, 2007-10-23 18:20:05+04:00, kaa@polly.(none) +2 -1
Made the 'log' system variable a synonym for 'general_log'.
diff -Nrup a/mysql-test/r/variables.result b/mysql-test/r/variables.result
--- a/mysql-test/r/variables.result 2007-08-03 02:14:22 +04:00
+++ b/mysql-test/r/variables.result 2007-10-23 18:20:05 +04:00
@@ -983,3 +983,33 @@ Variable_name='table_lock_wait_timeout';
Variable_name Value
table_definition_cache #
table_lock_wait_timeout #
+SHOW VARIABLES LIKE 'general_log';
+Variable_name Value
+general_log ON
+SHOW VARIABLES LIKE 'log';
+Variable_name Value
+log ON
+SELECT @@general_log, @@log;
+@@general_log @@log
+1 1
+SET GLOBAL log = 0;
+SHOW VARIABLES LIKE 'general_log';
+Variable_name Value
+general_log OFF
+SHOW VARIABLES LIKE 'log';
+Variable_name Value
+log OFF
+SELECT @@general_log, @@log;
+@@general_log @@log
+0 0
+SET GLOBAL general_log = 1;
+SHOW VARIABLES LIKE 'general_log';
+Variable_name Value
+general_log ON
+SHOW VARIABLES LIKE 'log';
+Variable_name Value
+log ON
+SELECT @@general_log, @@log;
+@@general_log @@log
+1 1
+End of 5.1 tests
diff -Nrup a/mysql-test/t/variables.test b/mysql-test/t/variables.test
--- a/mysql-test/t/variables.test 2007-08-03 02:14:22 +04:00
+++ b/mysql-test/t/variables.test 2007-10-23 18:20:05 +04:00
@@ -770,3 +770,21 @@ set global thread_cache_size =@m
--replace_column 2 #
show global variables where Variable_name='table_definition_cache' or
Variable_name='table_lock_wait_timeout';
+
+#
+# Bug #29131: SHOW VARIABLES reports variable 'log' but SET doesn't recognize it
+#
+
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+SET GLOBAL log = 0;
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+SET GLOBAL general_log = 1;
+SHOW VARIABLES LIKE 'general_log';
+SHOW VARIABLES LIKE 'log';
+SELECT @@general_log, @@log;
+
+--echo End of 5.1 tests
diff -Nrup a/sql/set_var.cc b/sql/set_var.cc
--- a/sql/set_var.cc 2007-10-10 11:35:47 +04:00
+++ b/sql/set_var.cc 2007-10-23 18:20:05 +04:00
@@ -641,6 +641,8 @@ static sys_var_const_str sys_license(&va
/* Global variables which enable|disable logging */
static sys_var_log_state sys_var_general_log(&vars, "general_log", &opt_log,
QUERY_LOG_GENERAL);
+static sys_var_log_state sys_var_log(&vars, "log", &opt_log,
+ QUERY_LOG_GENERAL);
static sys_var_log_state sys_var_slow_query_log(&vars, "slow_query_log", &opt_slow_log,
QUERY_LOG_SLOW);
sys_var_str sys_var_general_log_path(&vars, "general_log_file", sys_check_log_path,
@@ -678,7 +680,6 @@ static SHOW_VAR fixed_vars[]= {
#ifdef HAVE_MLOCKALL
{"locked_in_memory", (char*) &locked_in_memory, SHOW_MY_BOOL},
#endif
- {"log", (char*) &opt_log, SHOW_MY_BOOL},
{"log_bin", (char*) &opt_bin_log, SHOW_BOOL},
{"log_error", (char*) log_error_file, SHOW_CHAR},
{"log_slow_queries", (char*) &opt_slow_log, SHOW_MY_BOOL},
| Thread |
|---|
| • bk commit into 5.1 tree (kaa:1.2588) BUG#29131 | Alexey Kopytov | 23 Oct |