Merge lp:~tsarev/percona-server/test55_716210 into lp:percona-server/5.5

Proposed by Oleg Tsarev on 2011-09-06
Status: Work in progress
Proposed branch: lp:~tsarev/percona-server/test55_716210
Merge into: lp:percona-server/5.5
Diff against target: 231 lines (+153/-14) (has conflicts)
1 file modified
patches/slow_extended.patch (+153/-14)
Text conflict in patches/slow_extended.patch
To merge this branch: bzr merge lp:~tsarev/percona-server/test55_716210
Reviewer Review Type Date Requested Status
Percona developers 2011-09-06 Pending
Review via email: mp+74180@code.launchpad.net

Description of the change

Fixed bug #716210 - incorrect last_errno in slow-query-log

Unmerged revisions

156. By Oleg Tsarev on 2011-08-25

Fixed bug #716210 - incorrect last_errno in slow-query-log

155. By Oleg Tsarev on 2011-08-24

ported test percona_log_slow_parse_error for bug #716210 from lp:~longbow/percona-server/test_716210

152. By Stewart Smith on 2011-08-16

merge 5.5.15 rebase

151. By Stewart Smith on 2011-08-13

use S3 download site

150. By Stewart Smith on 2011-08-13

merge a few quilt related fixes to misc scripts we use

149. By Stewart Smith on 2011-08-13

merge atomic_cas_64 fix

148. By Stewart Smith on 2011-08-06

merge compiler warning fix for innodb comparison of unsigned expression always true

147. By Stewart Smith on 2011-08-05

merge fix of innodb_bug60049 test failure. The master thread should purge if purge_thread seems already exited in shutdown state.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'patches/slow_extended.patch'
2--- patches/slow_extended.patch 2011-09-03 15:15:31 +0000
3+++ patches/slow_extended.patch 2011-09-06 08:42:58 +0000
4@@ -549,15 +549,16 @@
5
6 /**
7 Dumps a text description of a thread, its security context
8-@@ -912,6 +943,7 @@
9+@@ -907,6 +938,8 @@
10+ const char* msg,
11+ MYSQL_ERROR ** cond_hdl)
12+ {
13++ last_errno= sql_errno;
14++
15+ if (!m_internal_handler)
16+ {
17 *cond_hdl= NULL;
18- return FALSE;
19- }
20-+ last_errno= sql_errno;
21-
22- for (Internal_error_handler *error_handler= m_internal_handler;
23- error_handler;
24-@@ -3656,6 +3688,12 @@
25+@@ -3656,6 +3689,12 @@
26 first_successful_insert_id_in_prev_stmt;
27 backup->first_successful_insert_id_in_cur_stmt=
28 first_successful_insert_id_in_cur_stmt;
29@@ -570,7 +571,7 @@
30
31 if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
32 !is_current_stmt_binlog_format_row())
33-@@ -3676,6 +3714,14 @@
34+@@ -3676,6 +3715,14 @@
35 cuted_fields= 0;
36 transaction.savepoints= 0;
37 first_successful_insert_id_in_cur_stmt= 0;
38@@ -585,7 +586,7 @@
39 }
40
41
42-@@ -3738,6 +3784,12 @@
43+@@ -3738,6 +3785,12 @@
44 */
45 examined_row_count+= backup->examined_row_count;
46 cuted_fields+= backup->cuted_fields;
47@@ -714,7 +715,15 @@
48 }
49 --- a/sql/sql_parse.cc
50 +++ b/sql/sql_parse.cc
51-@@ -1430,7 +1430,6 @@
52+@@ -888,6 +888,7 @@
53+ the slow log only if opt_log_slow_admin_statements is set.
54+ */
55+ thd->enable_slow_log= TRUE;
56++ thd->last_errno= 0;
57+ thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
58+ thd->set_time();
59+ if (!thd->is_valid_time())
60+@@ -1430,7 +1431,6 @@
61 DBUG_RETURN(error);
62 }
63
64@@ -722,7 +731,7 @@
65 void log_slow_statement(THD *thd)
66 {
67 DBUG_ENTER("log_slow_statement");
68-@@ -1443,6 +1442,42 @@
69+@@ -1443,6 +1443,42 @@
70 if (unlikely(thd->in_sub_stmt))
71 DBUG_VOID_RETURN; // Don't set time for sub stmt
72
73@@ -765,7 +774,7 @@
74 /*
75 Do not log administrative statements unless the appropriate option is
76 set.
77-@@ -1879,6 +1914,9 @@
78+@@ -1879,6 +1915,9 @@
79 context.resolve_in_table_list_only(select_lex->
80 table_list.first);
81
82@@ -775,7 +784,7 @@
83 /*
84 Reset warning count for each query that uses tables
85 A better approach would be to reset this for any commands
86-@@ -5297,6 +5335,21 @@
87+@@ -5297,6 +5336,21 @@
88 thd->rand_used= 0;
89 thd->sent_row_count= thd->examined_row_count= 0;
90
91@@ -1242,6 +1251,7 @@
92 };
93
94 # endif /* HAVE_PROFILING */
95+<<<<<<< TREE
96 --- /dev/null
97 +++ b/mysql-test/include/grep.inc
98 @@ -0,0 +1,16 @@
99@@ -2337,3 +2347,132 @@
100 +show global variables like 'slow_query_log_use_global_control';
101 +
102 +set global slow_query_log_use_global_control='long_query_time';
103+=======
104+--- /dev/null
105++++ b/mysql-test/include/log_start.inc
106+@@ -0,0 +1,16 @@
107++--let slow_query_log_file_old=`SELECT Variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE Variable_name = 'slow_query_log_file';`
108++--let slow_query_log_old=`SELECT Variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE Variable_name = 'slow_query_log';`
109++--disable_query_log
110++--let log_file_full_path = $MYSQLTEST_VARDIR/$log_file
111++SET GLOBAL slow_query_log=0;
112++perl;
113++ $log_file_full_path= $ENV{'log_file_full_path'};
114++ unlink $log_file_full_path;
115++ open(FILE, '>', $log_file_full_path)
116++ or die "Cannot create log file $log_file_full_path, reason: $!";
117++ close(FILE);
118++EOF
119++--echo [log_start.inc] $log_file
120++EVAL SET GLOBAL slow_query_log_file="$log_file_full_path";
121++SET GLOBAL slow_query_log=1;
122++--enable_query_log
123+--- /dev/null
124++++ b/mysql-test/include/log_stop.inc
125+@@ -0,0 +1,7 @@
126++--disable_query_log
127++FLUSH LOGS;
128++SET GLOBAL slow_query_log=0;
129++--echo [log_stop.inc] $log_file
130++EVAL SET GLOBAL slow_query_log_file= "$slow_query_log_file_old";
131++EVAL SET GLOBAL slow_query_log= $slow_query_log_old ;
132++--enable_query_log
133+--- /dev/null
134++++ b/mysql-test/r/percona_slow_extended_log_error.result
135+@@ -0,0 +1,11 @@
136++SET GLOBAL long_query_time=0;
137++SET GLOBAL slow_query_log_timestamp_always=ON;
138++SET long_query_time=0;
139++DROP TABLE IF EXISTS t1;
140++CREATE TABLE t1 (a INT);
141++[log_start.inc] percona.slow_extended.error_on_quit
142++CREATE TABLE t1 (a INT);
143++ERROR 42S01: Table 't1' already exists
144++[log_stop.inc] percona.slow_extended.error_on_quit
145++[log_grep.inc] file: percona.slow_extended.error_on_quit pattern: Last_errno: 1050
146++[log_grep.inc] lines: 1
147+--- /dev/null
148++++ b/mysql-test/t/percona_slow_extended_log_error.test
149+@@ -0,0 +1,23 @@
150++--let log_file=percona.slow_extended.error_on_quit
151++
152++SET GLOBAL long_query_time=0;
153++SET GLOBAL slow_query_log_timestamp_always=ON;
154++
155++connect (conn1,localhost,root,,);
156++connection conn1;
157++SET long_query_time=0;
158++--disable_warnings
159++DROP TABLE IF EXISTS t1;
160++--enable_warnings
161++CREATE TABLE t1 (a INT);
162++--source include/log_start.inc
163++--error 1050
164++CREATE TABLE t1 (a INT);
165++disconnect conn1;
166++connection default;
167++--source include/log_stop.inc
168++--let grep_pattern = Last_errno: 1050
169++--source include/log_grep.inc
170++SET GLOBAL long_query_time=default;
171++SET GLOBAL slow_query_log_timestamp_always=default;
172++DROP TABLE t1;
173+--- /dev/null
174++++ b/mysql-test/include/log_grep.inc
175+@@ -0,0 +1,17 @@
176++--disable_query_log
177++--echo [log_grep.inc] file: $log_file pattern: $grep_pattern
178++perl;
179++ $log_file= $ENV{'log_file'};
180++ $log_file_full_path= $ENV{'log_file_full_path'};
181++ $grep_pattern= $ENV{'grep_pattern'};
182++
183++ open(FILE, "$log_file_full_path")
184++ or die("Cannot open file $log_file_full_path: $!\n");
185++
186++ $lines = 0;
187++ while(<FILE>) {
188++ $lines++ if (/$grep_pattern/);
189++ }
190++ close(FILE);
191++ print "[log_grep.inc] lines: $lines\n";
192++EOF
193+--- /dev/null
194++++ b/mysql-test/r/percona_log_slow_parse_error.result
195+@@ -0,0 +1,10 @@
196++SET GLOBAL long_query_time=0;
197++SET GLOBAL slow_query_log_use_global_control='long_query_time';
198++DROP TABLE IF EXISTS t1;
199++CREATE TABLE t1 (a INT);
200++[log_start.inc] percona.slow_extended.log_slow_parse_error
201++CREATE TABLE t1 (a INT);
202++ERROR 42S01: Table 't1' already exists
203++[log_stop.inc] percona.slow_extended.log_slow_parse_error
204++[log_grep.inc] file: percona.slow_extended.log_slow_parse_error pattern: Last_errno: 1050
205++[log_grep.inc] lines: 1
206+--- /dev/null
207++++ b/mysql-test/t/percona_log_slow_parse_error.test
208+@@ -0,0 +1,22 @@
209++--let log_file=percona.slow_extended.log_slow_parse_error
210++
211++SET GLOBAL long_query_time=0;
212++SET GLOBAL slow_query_log_use_global_control='long_query_time';
213++
214++connect (conn1,localhost,root,,);
215++connection conn1;
216++--disable_warnings
217++DROP TABLE IF EXISTS t1;
218++--enable_warnings
219++CREATE TABLE t1 (a INT);
220++--source include/log_start.inc
221++--error 1050
222++CREATE TABLE t1 (a INT);
223++disconnect conn1;
224++connection default;
225++--source include/log_stop.inc
226++--let grep_pattern = Last_errno: 1050
227++--source include/log_grep.inc
228++SET GLOBAL long_query_time=default;
229++SET GLOBAL slow_query_log_use_global_control='';
230++DROP TABLE t1;
231+>>>>>>> MERGE-SOURCE

Subscribers

People subscribed via source and target branches