Comment 1 for bug 1385352

Revision history for this message
Valerii Kravchuk (valerii-kravchuk) wrote : Re: SET STATEMENT does not work after SET GLOBAL and affects the global value

This is easy to confirm:

[openxs@centos ~]$ mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.21-69.0 Percona Server (GPL), Release 69.0, Revision 675

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select @@global.lock_wait_timeout, @@session.lock_wait_timeout;
+----------------------------+-----------------------------+
| @@global.lock_wait_timeout | @@session.lock_wait_timeout |
+----------------------------+-----------------------------+
| 31536000 | 31536000 |
+----------------------------+-----------------------------+
1 row in set (0.00 sec)

mysql> set statement lock_wait_timeout=1 for select @@lock_wait_timeout;
+---------------------+
| @@lock_wait_timeout |
+---------------------+
| 1 |
+---------------------+
1 row in set (0.00 sec)

mysql> select @@global.lock_wait_timeout, @@session.lock_wait_timeout;
+----------------------------+-----------------------------+
| @@global.lock_wait_timeout | @@session.lock_wait_timeout |
+----------------------------+-----------------------------+
| 31536000 | 31536000 |
+----------------------------+-----------------------------+
1 row in set (0.00 sec)

mysql> set global general_log=0;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.lock_wait_timeout, @@session.lock_wait_timeout;
+----------------------------+-----------------------------+
| @@global.lock_wait_timeout | @@session.lock_wait_timeout |
+----------------------------+-----------------------------+
| 31536000 | 31536000 |
+----------------------------+-----------------------------+
1 row in set (0.00 sec)

mysql> set statement lock_wait_timeout=1 for select @@lock_wait_timeout;
+---------------------+
| @@lock_wait_timeout |
+---------------------+
| 31536000 |
+---------------------+
1 row in set (0.00 sec)

mysql> select @@global.lock_wait_timeout, @@session.lock_wait_timeout;
+----------------------------+-----------------------------+
| @@global.lock_wait_timeout | @@session.lock_wait_timeout |
+----------------------------+-----------------------------+
| 1 | 31536000 |
+----------------------------+-----------------------------+
1 row in set (0.00 sec)