Merge lp:~sergei.glushchenko/percona-server/5.5-ps-bug1182949 into lp:percona-server/5.5

Proposed by Sergei Glushchenko
Status: Work in progress
Proposed branch: lp:~sergei.glushchenko/percona-server/5.5-ps-bug1182949
Merge into: lp:percona-server/5.5
Prerequisite: lp:~sergei.glushchenko/percona-server/5.5-ps-bug1182535
Diff against target: 105 lines (+55/-18)
4 files modified
Percona-Server/mysql-test/r/percona_bug1182949.result (+12/-0)
Percona-Server/mysql-test/t/percona_bug1182949-master.opt (+1/-0)
Percona-Server/mysql-test/t/percona_bug1182949.test (+24/-0)
Percona-Server/sql/sql_prepare.cc (+18/-18)
To merge this branch: bzr merge lp:~sergei.glushchenko/percona-server/5.5-ps-bug1182949
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
Alexey Kopytov Pending
Review via email: mp+169203@code.launchpad.net

Description of the change

Merge fix for bug 1182949 from 5.1 series.
Add testcase for this bug with using audit_null plugin.

To post a comment you must log in.
Revision history for this message
Sergei Glushchenko (sergei.glushchenko) wrote :
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Same questions as in 5.1 MP, and same testcase notes as for bug 1182535 MP.

review: Needs Fixing

Unmerged revisions

462. By Sergei Glushchenko

Merge fix for bug 1182949 from 5.1 series.
Add testcase for this bug with using audit_null plugin.

461. By Sergei Glushchenko

Bug 1182535: no MYSQL_AUDIT_GENERAL_LOG notifications with general log off
The reason is that MYSQL_AUDIT_GENERAL_LOG events are emitted in the same
method which does general log writes. Method is not called either if
general_log is turned off or if we don't want to log specific command.
Fixed by moving that checks after audit notification is sent.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'Percona-Server/mysql-test/r/percona_bug1182949.result'
--- Percona-Server/mysql-test/r/percona_bug1182949.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/r/percona_bug1182949.result 2013-06-13 13:33:33 +0000
@@ -0,0 +1,12 @@
1SET @general_log_save = @@general_log;
2SET GLOBAL general_log=OFF;
3PREPARE stmt1 FROM 'SHOW STATUS LIKE "Audit_null_general_log"';
4INSTALL PLUGIN NULL_AUDIT SONAME 'AUDIT_NULL';
5EXECUTE stmt1;
6Variable_name Value
7Audit_null_general_log 2
8DEALLOCATE PREPARE stmt1;
9UNINSTALL PLUGIN NULL_AUDIT;
10Warnings:
11Warning 1620 Plugin is busy and will be uninstalled on shutdown
12SET GLOBAL general_log=@general_log_save;
013
=== added file 'Percona-Server/mysql-test/t/percona_bug1182949-master.opt'
--- Percona-Server/mysql-test/t/percona_bug1182949-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/t/percona_bug1182949-master.opt 2013-06-13 13:33:33 +0000
@@ -0,0 +1,1 @@
1$AUDIT_NULL_OPT
02
=== added file 'Percona-Server/mysql-test/t/percona_bug1182949.test'
--- Percona-Server/mysql-test/t/percona_bug1182949.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/t/percona_bug1182949.test 2013-06-13 13:33:33 +0000
@@ -0,0 +1,24 @@
1#########################################################################
2# Test for bug 1182949
3# Prepared statement execution logged after statement is executed
4#########################################################################
5
6--source include/have_audit_null.inc
7
8SET @general_log_save = @@general_log;
9SET GLOBAL general_log=OFF;
10
11PREPARE stmt1 FROM 'SHOW STATUS LIKE "Audit_null_general_log"';
12
13# load audit plugin
14--replace_result $AUDIT_NULL AUDIT_NULL
15--eval INSTALL PLUGIN NULL_AUDIT SONAME '$AUDIT_NULL'
16
17# status variable should show 2 queries
18EXECUTE stmt1;
19
20DEALLOCATE PREPARE stmt1;
21
22UNINSTALL PLUGIN NULL_AUDIT;
23
24SET GLOBAL general_log=@general_log_save;
025
=== modified file 'Percona-Server/sql/sql_prepare.cc'
--- Percona-Server/sql/sql_prepare.cc 2013-05-15 05:05:18 +0000
+++ Percona-Server/sql/sql_prepare.cc 2013-06-13 13:33:33 +0000
@@ -4088,6 +4088,24 @@
4088 thd->stmt_arena= this;4088 thd->stmt_arena= this;
4089 reinit_stmt_before_use(thd, lex);4089 reinit_stmt_before_use(thd, lex);
40904090
4091 /*
4092 Log COM_EXECUTE to the general log. Note, that in case of SQL
4093 prepared statements this causes two records to be output:
4094
4095 Query EXECUTE <statement name>
4096 Execute <statement SQL text>
4097
4098 This is considered user-friendly, since in the
4099 second log entry we output values of parameter markers.
4100
4101 Do not print anything if this is an SQL prepared statement and
4102 we're inside a stored procedure (also called Dynamic SQL) --
4103 sub-statements inside stored procedures are not logged into
4104 the general log.
4105 */
4106 if (thd->spcont == NULL)
4107 general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
4108
4091 /* Go! */4109 /* Go! */
40924110
4093 if (open_cursor)4111 if (open_cursor)
@@ -4144,24 +4162,6 @@
4144 thd->protocol->send_out_parameters(&this->lex->param_list);4162 thd->protocol->send_out_parameters(&this->lex->param_list);
4145 }4163 }
41464164
4147 /*
4148 Log COM_EXECUTE to the general log. Note, that in case of SQL
4149 prepared statements this causes two records to be output:
4150
4151 Query EXECUTE <statement name>
4152 Execute <statement SQL text>
4153
4154 This is considered user-friendly, since in the
4155 second log entry we output values of parameter markers.
4156
4157 Do not print anything if this is an SQL prepared statement and
4158 we're inside a stored procedure (also called Dynamic SQL) --
4159 sub-statements inside stored procedures are not logged into
4160 the general log.
4161 */
4162 if (error == 0 && thd->spcont == NULL)
4163 general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
4164
4165error:4165error:
4166 flags&= ~ (uint) IS_IN_USE;4166 flags&= ~ (uint) IS_IN_USE;
4167 return error;4167 return error;

Subscribers

People subscribed via source and target branches