Bug #35433 Some Static variables are writable through mysql session
Submitted: 19 Mar 2008 12:01 Modified: 21 May 2008 19:28
Reporter: Rizwan Maredia Email Updates:
Status: Closed
Category:Server: Docs Severity:S3 (Non-critical)
Version:5.1.22, 5.1.23 OS:Microsoft Windows (Windows XP)
Assigned to: Paul DuBois Target Version:
Tags: static variables, read-only variables. writable static variables
Triage: D4 (Minor)

[19 Mar 2008 12:01] Rizwan Maredia
Description:
The following variables are stated as non dynamic variables in the documentation

binlog_format
log_queries_not_using_indexes
myisam_use_mmap
sql_auto_is_null
thread_handling

Although they are not dynamic, their value can be set during a mysql session.

How to repeat:
SET @@GLOBAL.binlog_format=1;
SELECT @@GLOBAL.binlog_format;

SET @@GLOBAL.myisam_use_mmap=1;
SELECT @@GLOBAL.myisam_use_mmap;

SET @@GLOBAL.thread_handling=1;
SELECT @@GLOBAL.thread_handling;

SET @@SESSION.sql_auto_is_null=1;
SELECT @@SESSION.sql_auto_is_null;

SET @@GLOBAL.log_queries_not_using_indexes=1;
SELECT @@GLOBAL.log_queries_not_using_indexes;

Suggested fix:
The error ER_INCORRECT_GLOBAL_LOCAL_VAR should be thrown, saying that the variable's
value can not be set as it is a static variable.

OR

The documentation should be updated so that it does not state the variable as a dynamic
variable
[19 Mar 2008 12:52] Valeriy Kravchuk
Thank you for a problem report. Verified just as desribed with 5.1.23:

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -uroot -proot -P3310 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.1.23-rc-community-debug MySQL Community Server - Debug (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET @@GLOBAL.binlog_format=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@GLOBAL.binlog_format;
+------------------------+
| @@GLOBAL.binlog_format |
+------------------------+
| STATEMENT              |
+------------------------+
1 row in set (0.00 sec)

mysql> SET @@GLOBAL.myisam_use_mmap=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@GLOBAL.myisam_use_mmap;
+--------------------------+
| @@GLOBAL.myisam_use_mmap |
+--------------------------+
|                        1 |
+--------------------------+
1 row in set (0.00 sec)

mysql> SET @@GLOBAL.thread_handling=1;
ERROR 1238 (HY000): Variable 'thread_handling' is a read only variable
mysql> SELECT @@GLOBAL.thread_handling;
+---------------------------+
| @@GLOBAL.thread_handling  |
+---------------------------+
| one-thread-per-connection |
+---------------------------+
1 row in set (0.00 sec)

mysql> SET @@SESSION.sql_auto_is_null=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@SESSION.sql_auto_is_null;
+----------------------------+
| @@SESSION.sql_auto_is_null |
+----------------------------+
|                          1 |
+----------------------------+
1 row in set (0.00 sec)

mysql> SET @@GLOBAL.log_queries_not_using_indexes=1;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT @@GLOBAL.log_queries_not_using_indexes;
+----------------------------------------+
| @@GLOBAL.log_queries_not_using_indexes |
+----------------------------------------+
|                                      1 |
+----------------------------------------+
1 row in set (0.00 sec)

This manual page, http://dev.mysql.com/doc/refman/5.1/en/server-options.html, should be
fixed.
[21 May 2008 19:28] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The
updated documentation will appear on our website shortly, and will be included in the
next release of the relevant products.

I have not changed thread_handling to be listed as dynamic. It was a bug that it could be
changed at runtime, which has since been fixed. (Bug#30651)