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
1=== added file 'Percona-Server/mysql-test/r/percona_bug1182949.result'
2--- Percona-Server/mysql-test/r/percona_bug1182949.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/r/percona_bug1182949.result 2013-06-13 13:33:33 +0000
4@@ -0,0 +1,12 @@
5+SET @general_log_save = @@general_log;
6+SET GLOBAL general_log=OFF;
7+PREPARE stmt1 FROM 'SHOW STATUS LIKE "Audit_null_general_log"';
8+INSTALL PLUGIN NULL_AUDIT SONAME 'AUDIT_NULL';
9+EXECUTE stmt1;
10+Variable_name Value
11+Audit_null_general_log 2
12+DEALLOCATE PREPARE stmt1;
13+UNINSTALL PLUGIN NULL_AUDIT;
14+Warnings:
15+Warning 1620 Plugin is busy and will be uninstalled on shutdown
16+SET GLOBAL general_log=@general_log_save;
17
18=== added file 'Percona-Server/mysql-test/t/percona_bug1182949-master.opt'
19--- Percona-Server/mysql-test/t/percona_bug1182949-master.opt 1970-01-01 00:00:00 +0000
20+++ Percona-Server/mysql-test/t/percona_bug1182949-master.opt 2013-06-13 13:33:33 +0000
21@@ -0,0 +1,1 @@
22+$AUDIT_NULL_OPT
23
24=== added file 'Percona-Server/mysql-test/t/percona_bug1182949.test'
25--- Percona-Server/mysql-test/t/percona_bug1182949.test 1970-01-01 00:00:00 +0000
26+++ Percona-Server/mysql-test/t/percona_bug1182949.test 2013-06-13 13:33:33 +0000
27@@ -0,0 +1,24 @@
28+#########################################################################
29+# Test for bug 1182949
30+# Prepared statement execution logged after statement is executed
31+#########################################################################
32+
33+--source include/have_audit_null.inc
34+
35+SET @general_log_save = @@general_log;
36+SET GLOBAL general_log=OFF;
37+
38+PREPARE stmt1 FROM 'SHOW STATUS LIKE "Audit_null_general_log"';
39+
40+# load audit plugin
41+--replace_result $AUDIT_NULL AUDIT_NULL
42+--eval INSTALL PLUGIN NULL_AUDIT SONAME '$AUDIT_NULL'
43+
44+# status variable should show 2 queries
45+EXECUTE stmt1;
46+
47+DEALLOCATE PREPARE stmt1;
48+
49+UNINSTALL PLUGIN NULL_AUDIT;
50+
51+SET GLOBAL general_log=@general_log_save;
52
53=== modified file 'Percona-Server/sql/sql_prepare.cc'
54--- Percona-Server/sql/sql_prepare.cc 2013-05-15 05:05:18 +0000
55+++ Percona-Server/sql/sql_prepare.cc 2013-06-13 13:33:33 +0000
56@@ -4088,6 +4088,24 @@
57 thd->stmt_arena= this;
58 reinit_stmt_before_use(thd, lex);
59
60+ /*
61+ Log COM_EXECUTE to the general log. Note, that in case of SQL
62+ prepared statements this causes two records to be output:
63+
64+ Query EXECUTE <statement name>
65+ Execute <statement SQL text>
66+
67+ This is considered user-friendly, since in the
68+ second log entry we output values of parameter markers.
69+
70+ Do not print anything if this is an SQL prepared statement and
71+ we're inside a stored procedure (also called Dynamic SQL) --
72+ sub-statements inside stored procedures are not logged into
73+ the general log.
74+ */
75+ if (thd->spcont == NULL)
76+ general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
77+
78 /* Go! */
79
80 if (open_cursor)
81@@ -4144,24 +4162,6 @@
82 thd->protocol->send_out_parameters(&this->lex->param_list);
83 }
84
85- /*
86- Log COM_EXECUTE to the general log. Note, that in case of SQL
87- prepared statements this causes two records to be output:
88-
89- Query EXECUTE <statement name>
90- Execute <statement SQL text>
91-
92- This is considered user-friendly, since in the
93- second log entry we output values of parameter markers.
94-
95- Do not print anything if this is an SQL prepared statement and
96- we're inside a stored procedure (also called Dynamic SQL) --
97- sub-statements inside stored procedures are not logged into
98- the general log.
99- */
100- if (error == 0 && thd->spcont == NULL)
101- general_log_write(thd, COM_STMT_EXECUTE, thd->query(), thd->query_length());
102-
103 error:
104 flags&= ~ (uint) IS_IN_USE;
105 return error;

Subscribers

People subscribed via source and target branches