SET STATEMENT sql_log_off has no effect

Bug #1388407 reported by Elena Stepanova
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

MySQL [test]> set global general_log = 1, log_output = 'TABLE';
Query OK, 0 rows affected (0.00 sec)

MySQL [test]> exit
Bye

# Better do it in 2 sessions, to avoid the problems caused by the other bug with global variables

$ ml test --port=3307
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 MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.6.21-69.0-debug-log Source distribution

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

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

MySQL [test]> select @@sql_log_off;
+---------------+
| @@sql_log_off |
+---------------+
| 0 |
+---------------+
1 row in set (0.00 sec)

MySQL [test]> truncate table mysql.general_log;
Query OK, 0 rows affected (0.19 sec)

MySQL [test]> select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.13 sec)

MySQL [test]> set statement SQL_LOG_OFF = 1 for select 2;
+---+
| 2 |
+---+
| 2 |
+---+
1 row in set (0.00 sec)

MySQL [test]> set SQL_LOG_OFF = 1;
Query OK, 0 rows affected (0.01 sec)

MySQL [test]> select 3;
+---+
| 3 |
+---+
| 3 |
+---+
1 row in set (0.00 sec)

MySQL [test]> select * from mysql.general_log;
+---------------------+------------------------------+-----------+-----------+--------------+--------------------------------------------+
| event_time | user_host | thread_id | server_id | command_type | argument |
+---------------------+------------------------------+-----------+-----------+--------------+--------------------------------------------+
| 2014-11-01 21:17:32 | root[root] @ localhost [::1] | 21 | 1 | Query | select 1 |
| 2014-11-01 21:17:32 | root[root] @ localhost [::1] | 21 | 1 | Query | set statement SQL_LOG_OFF = 1 for select 2 |
| 2014-11-01 21:17:32 | root[root] @ localhost [::1] | 21 | 1 | Query | set SQL_LOG_OFF = 1 |
+---------------------+------------------------------+-----------+-----------+--------------+--------------------------------------------+
3 rows in set (0.00 sec)

Logging to file is also affected, table is just simpler for a test case.

Elena Stepanova (elenst)
description: updated
tags: added: set-statement
Revision history for this message
Nilnandan Joshi (nilnandan-joshi) wrote :

Able to reproduce with 5.6.21

nilnandan@Dell-XPS:~$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.6.21-70.0 Percona Server (GPL), Release 70.0, Revision 688

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>
mysql> set global general_log = 1, log_output = 'TABLE';
Query OK, 0 rows affected (0.01 sec)

mysql> select @@sql_log_off;
+---------------+
| @@sql_log_off |
+---------------+
| 0 |
+---------------+
1 row in set (0.01 sec)

mysql>
mysql> truncate table mysql.general_log;
Query OK, 0 rows affected (0.03 sec)

mysql>
mysql> select 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.01 sec)

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

mysql> set SQL_LOG_OFF = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> select 3;
+---+
| 3 |
+---+
| 3 |
+---+
1 row in set (0.00 sec)

mysql> select * from mysql.general_log;
+---------------------+---------------------------+-----------+-----------+--------------+--------------------------------------------+
| event_time | user_host | thread_id | server_id | command_type | argument |
+---------------------+---------------------------+-----------+-----------+--------------+--------------------------------------------+
| 2014-11-12 10:53:39 | root[root] @ localhost [] | 37 | 0 | Query | select 1 |
| 2014-11-12 10:53:45 | root[root] @ localhost [] | 37 | 0 | Query | set statement SQL_LOG_OFF = 1 for select 2 |
| 2014-11-12 10:53:50 | root[root] @ localhost [] | 37 | 0 | Query | set SQL_LOG_OFF = 1 |
+---------------------+---------------------------+-----------+-----------+--------------+--------------------------------------------+
3 rows in set (0.00 sec)

mysql>

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1575

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.