Merge lp:~percona-toolkit-dev/percona-toolkit/mysql-connect-errors-bug-1103045 into lp:percona-toolkit/2.1

Proposed by Daniel Nichter
Status: Merged
Approved by: Daniel Nichter
Approved revision: 528
Merged at revision: 526
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/mysql-connect-errors-bug-1103045
Merge into: lp:percona-toolkit/2.1
Diff against target: 1382 lines (+502/-105)
20 files modified
bin/pt-query-digest (+37/-9)
lib/MySQLProtocolParser.pm (+39/-9)
t/lib/MySQLProtocolParser.t (+108/-63)
t/lib/samples/tcpdump/tcpdump042.txt (+59/-0)
t/lib/samples/tcpdump/tcpdump043.txt (+82/-0)
t/lib/samples/tcpdump/tcpdump044.txt (+70/-0)
t/pt-query-digest/mysql_analyses.t (+26/-2)
t/pt-query-digest/samples/tcpdump001.txt (+0/-1)
t/pt-query-digest/samples/tcpdump002_report.txt (+0/-4)
t/pt-query-digest/samples/tcpdump012.txt (+0/-1)
t/pt-query-digest/samples/tcpdump017_report.txt (+0/-1)
t/pt-query-digest/samples/tcpdump021.txt (+0/-3)
t/pt-query-digest/samples/tcpdump022.txt (+0/-2)
t/pt-query-digest/samples/tcpdump023.txt (+0/-2)
t/pt-query-digest/samples/tcpdump024.txt (+0/-2)
t/pt-query-digest/samples/tcpdump025.txt (+0/-2)
t/pt-query-digest/samples/tcpdump033.txt (+0/-3)
t/pt-query-digest/samples/tcpdump041.txt (+0/-1)
t/pt-query-digest/samples/tcpdump043_report.txt (+41/-0)
t/pt-query-digest/samples/tcpdump044_report.txt (+40/-0)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/mysql-connect-errors-bug-1103045
Reviewer Review Type Date Requested Status
Daniel Nichter Approve
Review via email: mp+145006@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve
523. By Daniel Nichter

Catch and report aborted connects.

524. By Daniel Nichter

Only add Error_no to event if there is one. Don't stringify it either; set its type in pqd.

525. By Daniel Nichter

Remove other instance of 'none' Error_no in MySQLProtocolParser.pm.

526. By Daniel Nichter

Fix "Error: none" issue for tcpdump logs.

527. By Daniel Nichter

Make 'Connect abort' errors just 'Connect' so all connect errors are lumped together.

528. By Daniel Nichter

Add Error_msg (but no Error_no) when client closes connection during handshake.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/pt-query-digest'
2--- bin/pt-query-digest 2013-01-03 00:54:18 +0000
3+++ bin/pt-query-digest 2013-02-01 18:00:43 +0000
4@@ -3132,6 +3132,19 @@
5 if ( $packet->{data_len} == 0 ) {
6 PTDEBUG && _d('TCP control:',
7 map { uc $_ } grep { $packet->{$_} } qw(syn ack fin rst));
8+ if ( $packet->{'fin'}
9+ && ($session->{state} || '') eq 'server_handshake' ) {
10+ PTDEBUG && _d('Client aborted connection');
11+ my $event = {
12+ cmd => 'Admin',
13+ arg => 'administrator command: Connect',
14+ ts => $packet->{ts},
15+ };
16+ $session->{attribs}->{Error_msg} = 'Client closed connection during handshake';
17+ $event = $self->_make_event($event, $packet, $session);
18+ delete $self->{sessions}->{$session->{client}};
19+ return $event;
20+ }
21 return;
22 }
23
24@@ -3348,7 +3361,8 @@
25 }
26 my $event;
27
28- if ( $session->{state} eq 'client_auth' ) {
29+ if ( $session->{state} eq 'client_auth'
30+ || $session->{state} eq 'server_handshake' ) {
31 PTDEBUG && _d('Connection failed');
32 $event = {
33 cmd => 'Admin',
34@@ -3375,11 +3389,13 @@
35 }
36
37 $event = {
38- cmd => $com,
39- arg => $arg,
40- ts => $packet->{ts},
41- Error_no => $error->{errno} ? "#$error->{errno}" : 'none',
42+ cmd => $com,
43+ arg => $arg,
44+ ts => $packet->{ts},
45 };
46+ if ( $error->{errno} ) {
47+ $event->{Error_no} = $error->{errno};
48+ }
49 $session->{attribs}->{Error_msg} = $error->{message};
50 return $self->_make_event($event, $packet, $session);
51 }
52@@ -3590,13 +3606,17 @@
53 Thread_id => $session->{thread_id},
54 pos_in_log => $session->{pos_in_log},
55 Query_time => timestamp_diff($session->{ts}, $packet->{ts}),
56- Error_no => $event->{Error_no} || 'none',
57 Rows_affected => ($event->{Rows_affected} || 0),
58 Warning_count => ($event->{Warning_count} || 0),
59 No_good_index_used => ($event->{No_good_index_used} ? 'Yes' : 'No'),
60 No_index_used => ($event->{No_index_used} ? 'Yes' : 'No'),
61 };
62 @{$new_event}{keys %{$session->{attribs}}} = values %{$session->{attribs}};
63+ foreach my $opt_attrib ( qw(Error_no) ) {
64+ if ( defined $event->{$opt_attrib} ) {
65+ $new_event->{$opt_attrib} = $event->{$opt_attrib};
66+ }
67+ }
68 PTDEBUG && _d('Properties of event:', Dumper($new_event));
69
70 delete $session->{cmd};
71@@ -3727,9 +3747,17 @@
72 }
73 my $errno = to_num(substr($data, 0, 4));
74 my $marker = to_string(substr($data, 4, 2));
75- return unless $marker eq '#';
76- my $sqlstate = to_string(substr($data, 6, 10));
77- my $message = to_string(substr($data, 16));
78+ my $sqlstate = '';
79+ my $message = '';
80+ if ( $marker eq '#' ) {
81+ $sqlstate = to_string(substr($data, 6, 10));
82+ $message = to_string(substr($data, 16));
83+ }
84+ else {
85+ $marker = '';
86+ $message = to_string(substr($data, 4));
87+ }
88+ return unless $message;
89 my $pkt = {
90 errno => $errno,
91 sqlstate => $marker . $sqlstate,
92
93=== modified file 'lib/MySQLProtocolParser.pm'
94--- lib/MySQLProtocolParser.pm 2013-01-03 00:19:16 +0000
95+++ lib/MySQLProtocolParser.pm 2013-02-01 18:00:43 +0000
96@@ -340,6 +340,19 @@
97 if ( $packet->{data_len} == 0 ) {
98 PTDEBUG && _d('TCP control:',
99 map { uc $_ } grep { $packet->{$_} } qw(syn ack fin rst));
100+ if ( $packet->{'fin'}
101+ && ($session->{state} || '') eq 'server_handshake' ) {
102+ PTDEBUG && _d('Client aborted connection');
103+ my $event = {
104+ cmd => 'Admin',
105+ arg => 'administrator command: Connect',
106+ ts => $packet->{ts},
107+ };
108+ $session->{attribs}->{Error_msg} = 'Client closed connection during handshake';
109+ $event = $self->_make_event($event, $packet, $session);
110+ delete $self->{sessions}->{$session->{client}};
111+ return $event;
112+ }
113 return;
114 }
115
116@@ -612,7 +625,8 @@
117 }
118 my $event;
119
120- if ( $session->{state} eq 'client_auth' ) {
121+ if ( $session->{state} eq 'client_auth'
122+ || $session->{state} eq 'server_handshake' ) {
123 PTDEBUG && _d('Connection failed');
124 $event = {
125 cmd => 'Admin',
126@@ -641,11 +655,14 @@
127 }
128
129 $event = {
130- cmd => $com,
131- arg => $arg,
132- ts => $packet->{ts},
133- Error_no => $error->{errno} ? "#$error->{errno}" : 'none',
134+ cmd => $com,
135+ arg => $arg,
136+ ts => $packet->{ts},
137 };
138+ if ( $error->{errno} ) {
139+ # https://bugs.launchpad.net/percona-toolkit/+bug/823411
140+ $event->{Error_no} = $error->{errno};
141+ }
142 $session->{attribs}->{Error_msg} = $error->{message};
143 return $self->_make_event($event, $packet, $session);
144 }
145@@ -902,13 +919,18 @@
146 Thread_id => $session->{thread_id},
147 pos_in_log => $session->{pos_in_log},
148 Query_time => timestamp_diff($session->{ts}, $packet->{ts}),
149- Error_no => $event->{Error_no} || 'none',
150 Rows_affected => ($event->{Rows_affected} || 0),
151 Warning_count => ($event->{Warning_count} || 0),
152 No_good_index_used => ($event->{No_good_index_used} ? 'Yes' : 'No'),
153 No_index_used => ($event->{No_index_used} ? 'Yes' : 'No'),
154 };
155 @{$new_event}{keys %{$session->{attribs}}} = values %{$session->{attribs}};
156+ # https://bugs.launchpad.net/percona-toolkit/+bug/823411
157+ foreach my $opt_attrib ( qw(Error_no) ) {
158+ if ( defined $event->{$opt_attrib} ) {
159+ $new_event->{$opt_attrib} = $event->{$opt_attrib};
160+ }
161+ }
162 PTDEBUG && _d('Properties of event:', Dumper($new_event));
163
164 # Delete cmd to prevent re-making the same event if the
165@@ -1070,9 +1092,17 @@
166 }
167 my $errno = to_num(substr($data, 0, 4));
168 my $marker = to_string(substr($data, 4, 2));
169- return unless $marker eq '#';
170- my $sqlstate = to_string(substr($data, 6, 10));
171- my $message = to_string(substr($data, 16));
172+ my $sqlstate = '';
173+ my $message = '';
174+ if ( $marker eq '#' ) {
175+ $sqlstate = to_string(substr($data, 6, 10));
176+ $message = to_string(substr($data, 16));
177+ }
178+ else {
179+ $marker = '';
180+ $message = to_string(substr($data, 4));
181+ }
182+ return unless $message;
183 my $pkt = {
184 errno => $errno,
185 sqlstate => $marker . $sqlstate,
186
187=== modified file 't/lib/MySQLProtocolParser.t'
188--- t/lib/MySQLProtocolParser.t 2012-03-06 13:56:08 +0000
189+++ t/lib/MySQLProtocolParser.t 2013-02-01 18:00:43 +0000
190@@ -9,7 +9,7 @@
191 use strict;
192 use warnings FATAL => 'all';
193 use English qw(-no_match_vars);
194-use Test::More tests => 72;
195+use Test::More;
196
197 use MySQLProtocolParser;
198 use TcpdumpParser;
199@@ -38,7 +38,6 @@
200 pos_in_log => 0,
201 bytes => length('select "hello world" as greeting'),
202 cmd => 'Query',
203- Error_no => 'none',
204 Rows_affected => 0,
205 Warning_count => 0,
206 No_good_index_used => 'No',
207@@ -66,7 +65,6 @@
208 pos_in_log => 1470,
209 bytes => length('administrator command: Connect'),
210 cmd => 'Admin',
211- Error_no => 'none',
212 Rows_affected => 0,
213 Warning_count => 0,
214 No_good_index_used => 'No',
215@@ -84,7 +82,6 @@
216 pos_in_log => 2449,
217 ts => '090412 11:00:13.118643',
218 user => 'msandbox',
219- Error_no => 'none',
220 Rows_affected => 0,
221 Warning_count => 0,
222 No_good_index_used => 'No',
223@@ -102,7 +99,6 @@
224 pos_in_log => 3298,
225 ts => '090412 11:00:13.119079',
226 user => 'msandbox',
227- Error_no => 'none',
228 Rows_affected => 0,
229 Warning_count => 0,
230 No_good_index_used => 'No',
231@@ -120,7 +116,6 @@
232 pos_in_log => '4186',
233 ts => '090412 11:00:13.119487',
234 user => 'msandbox',
235- Error_no => 'none',
236 Rows_affected => 0,
237 Warning_count => 0,
238 No_good_index_used => 'No',
239@@ -177,7 +172,7 @@
240 pos_in_log => 0,
241 bytes => length('select 5 from foo'),
242 cmd => 'Query',
243- Error_no => "#1046",
244+ Error_no => "1046",
245 Error_msg => 'No database selected',
246 Rows_affected => 0,
247 Warning_count => 0,
248@@ -194,7 +189,7 @@
249 protocol => $protocol,
250 file => "$sample/tcpdump005.txt",
251 result => [
252- { Error_no => 'none',
253+ {
254 Rows_affected => 1,
255 Query_time => '0.000435',
256 Thread_id => 4294967296,
257@@ -212,7 +207,7 @@
258 No_good_index_used => 'No',
259 No_index_used => 'No',
260 },
261- { Error_no => 'none',
262+ {
263 Rows_affected => 2,
264 Query_time => '0.000565',
265 Thread_id => 4294967296,
266@@ -252,7 +247,6 @@
267 pos_in_log => 0,
268 bytes => length('select * from t'),
269 cmd => 'Query',
270- Error_no => 'none',
271 Rows_affected => 0,
272 Warning_count => 0,
273 No_good_index_used => 'No',
274@@ -280,7 +274,6 @@
275 pos_in_log => 0,
276 bytes => length('insert into t values(current_date)'),
277 cmd => 'Query',
278- Error_no => 'none',
279 Rows_affected => 1,
280 Warning_count => 1,
281 No_good_index_used => 'No',
282@@ -412,7 +405,6 @@
283 pos_in_log => 0,
284 bytes => length('select "hello world" as greeting'),
285 cmd => 'Query',
286- Error_no => 'none',
287 Rows_affected => 0,
288 Warning_count => 0,
289 No_good_index_used => 'No',
290@@ -434,7 +426,7 @@
291 file => "$sample/tcpdump013.txt",
292 desc => 'old password and compression',
293 result => [
294- { Error_no => 'none',
295+ {
296 No_good_index_used => 'No',
297 No_index_used => 'No',
298 Query_time => '0.034355',
299@@ -466,7 +458,6 @@
300 desc => 'in-stream compression detection',
301 result => [
302 {
303- Error_no => 'none',
304 No_good_index_used => 'No',
305 No_index_used => 'No',
306 Query_time => '0.001375',
307@@ -503,7 +494,6 @@
308 desc => 'compressed data',
309 result => [
310 {
311- Error_no => 'none',
312 No_good_index_used => 'No',
313 No_index_used => 'No',
314 Query_time => '0.006415',
315@@ -522,7 +512,6 @@
316 user => 'msandbox',
317 },
318 {
319- Error_no => 'none',
320 No_good_index_used => 'No',
321 No_index_used => 'Yes',
322 Query_time => '0.002884',
323@@ -541,7 +530,6 @@
324 user => 'msandbox',
325 },
326 {
327- Error_no => 'none',
328 No_good_index_used => 'No',
329 No_index_used => 'No',
330 Query_time => '0.000000',
331@@ -574,7 +562,6 @@
332 desc => 'TCP retransmission',
333 result => [
334 {
335- Error_no => 'none',
336 No_good_index_used => 'No',
337 No_index_used => 'No',
338 Query_time => '0.001000',
339@@ -607,7 +594,6 @@
340 desc => 'Multiple servers',
341 result => [
342 {
343- Error_no => 'none',
344 No_good_index_used => 'No',
345 No_index_used => 'No',
346 Query_time => '0.000206',
347@@ -626,7 +612,6 @@
348 user => undef,
349 },
350 {
351- Error_no => 'none',
352 No_good_index_used => 'No',
353 No_index_used => 'No',
354 Query_time => '0.000203',
355@@ -656,7 +641,6 @@
356 desc => 'Multiple servers but watch only one',
357 result => [
358 {
359- Error_no => 'none',
360 No_good_index_used => 'No',
361 No_index_used => 'No',
362 Query_time => '0.000206',
363@@ -713,7 +697,6 @@
364 desc => 'prepared statements, simple, no NULL',
365 result => [
366 {
367- Error_no => 'none',
368 No_good_index_used => 'No',
369 No_index_used => 'No',
370 Query_time => '0.000286',
371@@ -733,7 +716,6 @@
372 Statement_id => 2,
373 },
374 {
375- Error_no => 'none',
376 No_good_index_used => 'No',
377 No_index_used => 'Yes',
378 Query_time => '0.000281',
379@@ -753,7 +735,6 @@
380 Statement_id => 2,
381 },
382 {
383- Error_no => 'none',
384 No_good_index_used => 'No',
385 No_index_used => 'No',
386 Query_time => '0.000000',
387@@ -782,7 +763,6 @@
388 desc => 'prepared statements, NULL value',
389 result => [
390 {
391- Error_no => 'none',
392 No_good_index_used => 'No',
393 No_index_used => 'No',
394 Query_time => '0.000303',
395@@ -802,7 +782,6 @@
396 Statement_id => 2,
397 },
398 {
399- Error_no => 'none',
400 No_good_index_used => 'No',
401 No_index_used => 'No',
402 Query_time => '0.000186',
403@@ -832,7 +811,6 @@
404 desc => 'prepared statements, string, char and float',
405 result => [
406 {
407- Error_no => 'none',
408 No_good_index_used => 'No',
409 No_index_used => 'No',
410 Query_time => '0.000315',
411@@ -852,7 +830,6 @@
412 Statement_id => 2,
413 },
414 {
415- Error_no => 'none',
416 No_good_index_used => 'No',
417 No_index_used => 'No',
418 Query_time => '0.000249',
419@@ -882,7 +859,6 @@
420 desc => 'prepared statements, all NULL',
421 result => [
422 {
423- Error_no => 'none',
424 No_good_index_used => 'No',
425 No_index_used => 'No',
426 Query_time => '0.000278',
427@@ -902,7 +878,6 @@
428 Statement_id => 2,
429 },
430 {
431- Error_no => 'none',
432 No_good_index_used => 'No',
433 No_index_used => 'No',
434 Query_time => '0.000159',
435@@ -932,7 +907,6 @@
436 desc => 'prepared statements, no params',
437 result => [
438 {
439- Error_no => 'none',
440 No_good_index_used => 'No',
441 No_index_used => 'No',
442 Query_time => '0.000268',
443@@ -952,7 +926,6 @@
444 Statement_id => 2,
445 },
446 {
447- Error_no => 'none',
448 No_good_index_used => 'No',
449 No_index_used => 'Yes',
450 Query_time => '0.000234',
451@@ -982,7 +955,6 @@
452 desc => 'prepared statements, close statement',
453 result => [
454 {
455- Error_no => 'none',
456 No_good_index_used => 'No',
457 No_index_used => 'No',
458 Query_time => '0.000000',
459@@ -1011,7 +983,6 @@
460 desc => 'prepared statements, reset statement',
461 result => [
462 {
463- Error_no => 'none',
464 No_good_index_used => 'No',
465 No_index_used => 'No',
466 Query_time => '0.000023',
467@@ -1041,7 +1012,6 @@
468 desc => 'prepared statements, multiple exec, new param',
469 result => [
470 {
471- Error_no => 'none',
472 No_good_index_used => 'No',
473 No_index_used => 'No',
474 Query_time => '0.000292',
475@@ -1061,7 +1031,6 @@
476 user => undef
477 },
478 {
479- Error_no => 'none',
480 No_good_index_used => 'No',
481 No_index_used => 'Yes',
482 Query_time => '0.000254',
483@@ -1081,7 +1050,6 @@
484 user => undef
485 },
486 {
487- Error_no => 'none',
488 No_good_index_used => 'No',
489 No_index_used => 'Yes',
490 Query_time => '0.000190',
491@@ -1101,7 +1069,6 @@
492 user => undef
493 },
494 {
495- Error_no => 'none',
496 No_good_index_used => 'No',
497 No_index_used => 'Yes',
498 Query_time => '0.000166',
499@@ -1131,7 +1098,6 @@
500 desc => 'prepared statements, real param types',
501 result => [
502 {
503- Error_no => 'none',
504 No_good_index_used => 'No',
505 No_index_used => 'No',
506 Query_time => '0.000221',
507@@ -1151,7 +1117,6 @@
508 user => undef
509 },
510 {
511- Error_no => 'none',
512 No_good_index_used => 'No',
513 No_index_used => 'No',
514 Query_time => '0.000203',
515@@ -1171,7 +1136,6 @@
516 user => undef
517 },
518 {
519- Error_no => 'none',
520 No_good_index_used => 'No',
521 No_index_used => 'No',
522 Query_time => '0.000000',
523@@ -1190,7 +1154,6 @@
524 user => undef
525 },
526 {
527- Error_no => 'none',
528 No_good_index_used => 'No',
529 No_index_used => 'No',
530 Query_time => '0.000000',
531@@ -1219,7 +1182,6 @@
532 desc => 'prepared statements, ok response to execute',
533 result => [
534 {
535- Error_no => 'none',
536 No_good_index_used => 'No',
537 No_index_used => 'No',
538 Query_time => '0.000046',
539@@ -1239,7 +1201,6 @@
540 user => undef
541 },
542 {
543- Error_no => 'none',
544 No_good_index_used => 'No',
545 No_index_used => 'No',
546 Query_time => '0.000024',
547@@ -1269,7 +1230,6 @@
548 desc => 'prepared statements, NULL bitmap',
549 result => [
550 {
551- Error_no => 'none',
552 No_good_index_used => 'No',
553 No_index_used => 'No',
554 Query_time => '0.000288',
555@@ -1289,7 +1249,6 @@
556 user => undef
557 },
558 {
559- Error_no => 'none',
560 No_good_index_used => 'No',
561 No_index_used => 'No',
562 Query_time => '0.000322',
563@@ -1322,7 +1281,6 @@
564 desc => 'issue 761',
565 result => [
566 {
567- Error_no => 'none',
568 No_good_index_used => 'No',
569 No_index_used => 'No',
570 Query_time => '0.000431',
571@@ -1354,7 +1312,6 @@
572 desc => 'issue 760',
573 result => [
574 {
575- Error_no => 'none',
576 No_good_index_used => 'No',
577 No_index_used => 'No',
578 Query_time => '0.000430',
579@@ -1397,7 +1354,6 @@
580 pos_in_log => 1470,
581 bytes => length('administrator command: Connect'),
582 cmd => 'Admin',
583- Error_no => 'none',
584 Rows_affected => 0,
585 Warning_count => 0,
586 No_good_index_used => 'No',
587@@ -1415,7 +1371,6 @@
588 pos_in_log => 2449,
589 ts => '090412 11:00:13.119079',
590 user => 'msandbox',
591- Error_no => 'none',
592 Rows_affected => 0,
593 Warning_count => 0,
594 No_good_index_used => 'No',
595@@ -1433,7 +1388,6 @@
596 pos_in_log => 3337,
597 ts => '090412 11:00:13.119487',
598 user => 'msandbox',
599- Error_no => 'none',
600 Rows_affected => 0,
601 Warning_count => 0,
602 No_good_index_used => 'No',
603@@ -1441,7 +1395,6 @@
604 },
605 # port reused...
606 { ts => '090412 12:00:00.800000',
607- Error_no => 'none',
608 No_good_index_used => 'No',
609 No_index_used => 'No',
610 Query_time => '0.700000',
611@@ -1459,7 +1412,6 @@
612 user => 'msandbox',
613 },
614 { ts => '090412 12:00:01.000000',
615- Error_no => 'none',
616 No_good_index_used => 'No',
617 No_index_used => 'No',
618 Query_time => '0.100000',
619@@ -1477,7 +1429,6 @@
620 user => 'msandbox',
621 },
622 { ts => '090412 12:00:01.100000',
623- Error_no => 'none',
624 No_good_index_used => 'No',
625 No_index_used => 'No',
626 Query_time => '0.000000',
627@@ -1516,7 +1467,6 @@
628 pos_in_log => 1470,
629 bytes => length('administrator command: Connect'),
630 cmd => 'Admin',
631- Error_no => 'none',
632 Rows_affected => 0,
633 Warning_count => 0,
634 No_good_index_used => 'No',
635@@ -1524,7 +1474,6 @@
636 },
637 # port reused...
638 { ts => '090412 12:00:00.800000',
639- Error_no => 'none',
640 No_good_index_used => 'No',
641 No_index_used => 'No',
642 Query_time => '0.700000',
643@@ -1542,7 +1491,6 @@
644 user => 'msandbox',
645 },
646 { ts => '090412 12:00:01.000000',
647- Error_no => 'none',
648 No_good_index_used => 'No',
649 No_index_used => 'No',
650 Query_time => '0.100000',
651@@ -1560,7 +1508,6 @@
652 user => 'msandbox',
653 },
654 { ts => '090412 12:00:01.100000',
655- Error_no => 'none',
656 No_good_index_used => 'No',
657 No_index_used => 'No',
658 Query_time => '0.000000',
659@@ -1588,7 +1535,6 @@
660 desc => 'no server ok (issue 794)',
661 result => [
662 { ts => '090412 12:00:01.000000',
663- Error_no => 'none',
664 No_good_index_used => 'No',
665 No_index_used => 'No',
666 Query_time => '0.000000',
667@@ -1606,7 +1552,6 @@
668 user => undef
669 },
670 { ts => '090412 12:00:03.000000',
671- Error_no => 'none',
672 No_good_index_used => 'No',
673 No_index_used => 'No',
674 Query_time => '1.000000',
675@@ -1659,7 +1604,7 @@
676 [
677 {
678 Error_msg => "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1",
679- Error_no => '#1064',
680+ Error_no => '1064',
681 No_good_index_used => 'No',
682 No_index_used => 'No',
683 Query_time => '0.000316',
684@@ -1679,7 +1624,7 @@
685 },
686 {
687 Error_msg => 'Unknown system variable \'nono\'',
688- Error_no => '#1193',
689+ Error_no => '1193',
690 No_good_index_used => 'No',
691 No_index_used => 'No',
692 Query_time => '0.000329',
693@@ -1701,6 +1646,106 @@
694 );
695
696 # #############################################################################
697+# Bug 1103045: pt-query-digest fails to parse non-SQL errors
698+# https://bugs.launchpad.net/percona-toolkit/+bug/1103045
699+# #############################################################################
700+
701+$protocol = new MySQLProtocolParser(
702+ server => '127.0.0.1',
703+ port => '12345',
704+);
705+
706+test_protocol_parser(
707+ parser => $tcpdump,
708+ protocol => $protocol,
709+ file => "$sample/tcpdump043.txt",
710+ desc => 'Bad connection',
711+ result =>
712+ [
713+ {
714+ Error_msg => 'Got packets out of order',
715+ Error_no => 1156,
716+ No_good_index_used => 'No',
717+ No_index_used => 'No',
718+ Query_time => '3.536306',
719+ Rows_affected => 0,
720+ Thread_id => 27,
721+ Warning_count => 0,
722+ arg => 'administrator command: Connect',
723+ bytes => 30,
724+ cmd => 'Admin',
725+ db => undef,
726+ host => '127.0.0.1',
727+ ip => '127.0.0.1',
728+ port => '62160',
729+ pos_in_log => undef,
730+ ts => '130124 13:03:28.672987',
731+ user => undef,
732+ }
733+ ],
734+);
735+
736+test_protocol_parser(
737+ parser => $tcpdump,
738+ protocol => $protocol,
739+ file => "$sample/tcpdump042.txt",
740+ desc => 'Client went away during handshake',
741+ result => [
742+ {
743+ No_good_index_used => 'No',
744+ No_index_used => 'No',
745+ Query_time => '9.998411',
746+ Rows_affected => 0,
747+ Thread_id => 24,
748+ Warning_count => 0,
749+ arg => 'administrator command: Connect',
750+ bytes => 30,
751+ cmd => 'Admin',
752+ db => undef,
753+ host => '127.0.0.1',
754+ ip => '127.0.0.1',
755+ port => '62133',
756+ pos_in_log => undef,
757+ ts => '130124 12:55:48.274417',
758+ user => undef,
759+ Error_msg => 'Client closed connection during handshake',
760+ }
761+ ],
762+);
763+
764+$protocol = new MySQLProtocolParser(
765+ server => '100.0.0.1',
766+);
767+
768+test_protocol_parser(
769+ parser => $tcpdump,
770+ protocol => $protocol,
771+ file => "$sample/tcpdump044.txt",
772+ desc => 'Client aborted connection (bug 1103045)',
773+ result => [
774+ {
775+ No_good_index_used => 'No',
776+ No_index_used => 'No',
777+ Query_time => '3.819507',
778+ Rows_affected => 0,
779+ Thread_id => 13,
780+ Warning_count => 0,
781+ arg => 'administrator command: Connect',
782+ bytes => 30,
783+ cmd => 'Admin',
784+ db => undef,
785+ host => '100.0.0.2',
786+ ip => '100.0.0.2',
787+ port => '44432',
788+ pos_in_log => undef,
789+ ts => '130122 09:55:57.793375',
790+ user => undef,
791+ Error_msg => 'Client closed connection during handshake',
792+ },
793+ ],
794+);
795+
796+# #############################################################################
797 # Done.
798 # #############################################################################
799-exit;
800+done_testing;
801
802=== added file 't/lib/samples/tcpdump/tcpdump042.txt'
803--- t/lib/samples/tcpdump/tcpdump042.txt 1970-01-01 00:00:00 +0000
804+++ t/lib/samples/tcpdump/tcpdump042.txt 2013-02-01 18:00:43 +0000
805@@ -0,0 +1,59 @@
806+2013-01-24 12:55:38.276006 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
807+ 0x0000: 4510 0040 b290 4000 4006 0000 7f00 0001
808+ 0x0010: 7f00 0001 f2b5 3039 58cf 8e7c 0000 0000
809+ 0x0020: b002 ffff fe34 0000 0204 3fd8 0103 0303
810+ 0x0030: 0101 080a 0580 fe1f 0000 0000 0402 0000
811+2013-01-24 12:55:38.276053 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
812+ 0x0000: 4500 0040 65de 4000 4006 0000 7f00 0001
813+ 0x0010: 7f00 0001 3039 f2b5 1c49 dad0 58cf 8e7d
814+ 0x0020: b012 ffff fe34 0000 0204 3fd8 0103 0303
815+ 0x0030: 0101 080a 0580 fe1f 0580 fe1f 0402 0000
816+2013-01-24 12:55:38.276062 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
817+ 0x0000: 4510 0034 2fb2 4000 4006 0000 7f00 0001
818+ 0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 dad1
819+ 0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
820+ 0x0030: 0580 fe1f
821+2013-01-24 12:55:38.276071 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
822+ 0x0000: 4500 0034 4cba 4000 4006 0000 7f00 0001
823+ 0x0010: 7f00 0001 3039 f2b5 1c49 dad1 58cf 8e7d
824+ 0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
825+ 0x0030: 0580 fe1f
826+2013-01-24 12:55:38.278813 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 60
827+ 0x0000: 4508 0070 e5f9 4000 4006 0000 7f00 0001
828+ 0x0010: 7f00 0001 3039 f2b5 1c49 dad1 58cf 8e7d
829+ 0x0020: 8018 ffff fe64 0000 0101 080a 0580 fe1f
830+ 0x0030: 0580 fe1f 3800 0000 0a35 2e31 2e35 332d
831+ 0x0040: 6c6f 6700 1800 0000 6553 5179 332d 2925
832+ 0x0050: 00ff f708 0200 0000 0000 0000 0000 0000
833+ 0x0060: 0000 007b 6154 5f62 4d3d 274a 2269 6900
834+2013-01-24 12:55:38.278831 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
835+ 0x0000: 4510 0034 0cb3 4000 4006 0000 7f00 0001
836+ 0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0d
837+ 0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe1f
838+ 0x0030: 0580 fe1f
839+2013-01-24 12:55:48.274417 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
840+ 0x0000: 4508 0034 5ba9 4000 4006 0000 7f00 0001
841+ 0x0010: 7f00 0001 3039 f2b5 1c49 db0d 58cf 8e7d
842+ 0x0020: 8011 ffff fe28 0000 0101 080a 0580 fe83
843+ 0x0030: 0580 fe1f
844+2013-01-24 12:55:48.274515 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
845+ 0x0000: 4510 0034 4493 4000 4006 0000 7f00 0001
846+ 0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0e
847+ 0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe83
848+ 0x0030: 0580 fe83
849+2013-01-24 12:55:48.274541 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
850+ 0x0000: 4508 0034 cfea 4000 4006 0000 7f00 0001
851+ 0x0010: 7f00 0001 3039 f2b5 1c49 db0e 58cf 8e7d
852+ 0x0020: 8010 ffff fe28 0000 0101 080a 0580 fe83
853+ 0x0030: 0580 fe83
854+2013-01-24 12:55:48.274741 IP 127.0.0.1.62133 > 127.0.0.1.12345: tcp 0
855+ 0x0000: 4510 0034 6e98 4000 4006 0000 7f00 0001
856+ 0x0010: 7f00 0001 f2b5 3039 58cf 8e7d 1c49 db0e
857+ 0x0020: 8011 ffff fe28 0000 0101 080a 0580 fe83
858+ 0x0030: 0580 fe83
859+2013-01-24 12:55:48.274836 IP 127.0.0.1.12345 > 127.0.0.1.62133: tcp 0
860+ 0x0000: 4508 0034 bcc4 4000 4006 0000 7f00 0001
861+ 0x0010: 7f00 0001 3039 f2b5 1c49 db0e 58cf 8e7e
862+ 0x0020: 8010 fffe fe28 0000 0101 080a 0580 fe83
863+ 0x0030: 0580 fe83
864+
865
866=== added file 't/lib/samples/tcpdump/tcpdump043.txt'
867--- t/lib/samples/tcpdump/tcpdump043.txt 1970-01-01 00:00:00 +0000
868+++ t/lib/samples/tcpdump/tcpdump043.txt 2013-02-01 18:00:43 +0000
869@@ -0,0 +1,82 @@
870+2013-01-24 13:03:25.136681 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
871+ 0x0000: 4510 0040 ea0e 4000 4006 0000 7f00 0001
872+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d49 0000 0000
873+ 0x0020: b002 ffff fe34 0000 0204 3fd8 0103 0303
874+ 0x0030: 0101 080a 0581 1055 0000 0000 0402 0000
875+2013-01-24 13:03:25.136728 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
876+ 0x0000: 4500 0040 dc6f 4000 4006 0000 7f00 0001
877+ 0x0010: 7f00 0001 3039 f2d0 7d01 6881 ad71 3d4a
878+ 0x0020: b012 ffff fe34 0000 0204 3fd8 0103 0303
879+ 0x0030: 0101 080a 0581 1055 0581 1055 0402 0000
880+2013-01-24 13:03:25.136737 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
881+ 0x0000: 4510 0034 0e53 4000 4006 0000 7f00 0001
882+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 6882
883+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
884+ 0x0030: 0581 1055
885+2013-01-24 13:03:25.136746 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
886+ 0x0000: 4500 0034 f54e 4000 4006 0000 7f00 0001
887+ 0x0010: 7f00 0001 3039 f2d0 7d01 6882 ad71 3d4a
888+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
889+ 0x0030: 0581 1055
890+2013-01-24 13:03:25.146062 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 60
891+ 0x0000: 4508 0070 6334 4000 4006 0000 7f00 0001
892+ 0x0010: 7f00 0001 3039 f2d0 7d01 6882 ad71 3d4a
893+ 0x0020: 8018 ffff fe64 0000 0101 080a 0581 1055
894+ 0x0030: 0581 1055 3800 0000 0a35 2e31 2e35 332d
895+ 0x0040: 6c6f 6700 1b00 0000 4d34 5946 3267 3260
896+ 0x0050: 00ff f708 0200 0000 0000 0000 0000 0000
897+ 0x0060: 0000 006c 225e 3633 3a6c 3048 5863 6800
898+2013-01-24 13:03:25.146080 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
899+ 0x0000: 4510 0034 3e79 4000 4006 0000 7f00 0001
900+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 68be
901+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1055
902+ 0x0030: 0581 1055
903+2013-01-24 13:03:28.672802 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 15
904+ 0x0000: 4510 0043 145a 4000 4006 0000 7f00 0001
905+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d4a 7d01 68be
906+ 0x0020: 8018 ffff fe37 0000 0101 080a 0581 1079
907+ 0x0030: 0581 1055 6865 6c6c 6f2c 2077 6f72 6c64
908+ 0x0040: 210d 0a
909+2013-01-24 13:03:28.672856 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
910+ 0x0000: 4508 0034 b07b 4000 4006 0000 7f00 0001
911+ 0x0010: 7f00 0001 3039 f2d0 7d01 68be ad71 3d59
912+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
913+ 0x0030: 0581 1079
914+2013-01-24 13:03:28.672987 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 31
915+ 0x0000: 4508 0053 6336 4000 4006 0000 7f00 0001
916+ 0x0010: 7f00 0001 3039 f2d0 7d01 68be ad71 3d59
917+ 0x0020: 8018 ffff fe47 0000 0101 080a 0581 1079
918+ 0x0030: 0581 1079 1b00 0001 ff84 0447 6f74 2070
919+ 0x0040: 6163 6b65 7473 206f 7574 206f 6620 6f72
920+ 0x0050: 6465 72
921+2013-01-24 13:03:28.673017 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
922+ 0x0000: 4510 0034 fb76 4000 4006 0000 7f00 0001
923+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68dd
924+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
925+ 0x0030: 0581 1079
926+2013-01-24 13:03:28.673103 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
927+ 0x0000: 4508 0034 ae21 4000 4006 0000 7f00 0001
928+ 0x0010: 7f00 0001 3039 f2d0 7d01 68dd ad71 3d59
929+ 0x0020: 8011 ffff fe28 0000 0101 080a 0581 1079
930+ 0x0030: 0581 1079
931+2013-01-24 13:03:28.673139 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
932+ 0x0000: 4510 0034 d821 4000 4006 0000 7f00 0001
933+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68de
934+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
935+ 0x0030: 0581 1079
936+2013-01-24 13:03:28.673156 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
937+ 0x0000: 4508 0034 ab2e 4000 4006 0000 7f00 0001
938+ 0x0010: 7f00 0001 3039 f2d0 7d01 68de ad71 3d59
939+ 0x0020: 8010 ffff fe28 0000 0101 080a 0581 1079
940+ 0x0030: 0581 1079
941+2013-01-24 13:03:28.673444 IP 127.0.0.1.62160 > 127.0.0.1.12345: tcp 0
942+ 0x0000: 4510 0034 e03d 4000 4006 0000 7f00 0001
943+ 0x0010: 7f00 0001 f2d0 3039 ad71 3d59 7d01 68de
944+ 0x0020: 8011 ffff fe28 0000 0101 080a 0581 1079
945+ 0x0030: 0581 1079
946+2013-01-24 13:03:28.673464 IP 127.0.0.1.12345 > 127.0.0.1.62160: tcp 0
947+ 0x0000: 4508 0034 b22d 4000 4006 0000 7f00 0001
948+ 0x0010: 7f00 0001 3039 f2d0 7d01 68de ad71 3d5a
949+ 0x0020: 8010 fffe fe28 0000 0101 080a 0581 1079
950+ 0x0030: 0581 1079
951+
952
953=== added file 't/lib/samples/tcpdump/tcpdump044.txt'
954--- t/lib/samples/tcpdump/tcpdump044.txt 1970-01-01 00:00:00 +0000
955+++ t/lib/samples/tcpdump/tcpdump044.txt 2013-02-01 18:00:43 +0000
956@@ -0,0 +1,70 @@
957+2013-01-22 09:55:53.973868 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
958+ 0x0000: 4510 003c bbae 4000 4006 f033 0a1c bd48
959+ 0x0010: 0a1c bd49 ad90 0cea af89 ab81 0000 0000
960+ 0x0020: a002 16d0 f7a5 0000 0204 05b4 0402 080a
961+ 0x0030: 850b 102f 0000 0000 0103 0307
962+2013-01-22 09:55:53.973885 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
963+ 0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
964+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
965+ 0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
966+ 0x0030: 7a96 7b52 850b 102f 0103 0307
967+2013-01-22 09:55:53.973886 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
968+ 0x0000: 4500 003c 0000 4000 4006 abf2 0a1c bd49
969+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5ddd af89 ab82
970+ 0x0020: a012 16a0 e720 0000 0204 05b4 0402 080a
971+ 0x0030: 7a96 7b52 850b 102f 0103 0307
972+2013-01-22 09:55:53.973929 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
973+ 0x0000: 4510 0034 bbaf 4000 4006 f03a 0a1c bd48
974+ 0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5dde
975+ 0x0020: 8010 002e 2c5f 0000 0101 080a 850b 102f
976+ 0x0030: 7a96 7b52
977+2013-01-22 09:55:53.974017 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
978+ 0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
979+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
980+ 0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
981+ 0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
982+ 0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
983+ 0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
984+ 0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
985+ 0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
986+ 0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
987+ 0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
988+ 0x00a0: 776f 7264 00
989+2013-01-22 09:55:53.974019 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 113
990+ 0x0000: 4508 00a5 268c 4000 4006 84f5 0a1c bd49
991+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5dde af89 ab82
992+ 0x0020: 8018 002e 8f61 0000 0101 080a 7a96 7b52
993+ 0x0030: 850b 102f 6d00 0000 0a35 2e35 2e32 382d
994+ 0x0040: 656e 7465 7270 7269 7365 2d63 6f6d 6d65
995+ 0x0050: 7263 6961 6c2d 6164 7661 6e63 6564 2d6c
996+ 0x0060: 6f67 000d 0000 006c 706d 5338 5d4a 3c00
997+ 0x0070: fff7 0802 000f 8015 0000 0000 0000 0000
998+ 0x0080: 0000 2f72 7265 247e 7347 4565 4f3c 006d
999+ 0x0090: 7973 716c 5f6e 6174 6976 655f 7061 7373
1000+ 0x00a0: 776f 7264 00
1001+2013-01-22 09:55:53.974064 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
1002+ 0x0000: 4510 0034 bbb0 4000 4006 f039 0a1c bd48
1003+ 0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
1004+ 0x0020: 8010 002e 2bee 0000 0101 080a 850b 102f
1005+ 0x0030: 7a96 7b52
1006+2013-01-22 09:55:57.793375 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
1007+ 0x0000: 4510 0034 bbb1 4000 4006 f038 0a1c bd48
1008+ 0x0010: 0a1c bd49 ad90 0cea af89 ab82 bcdd 5e4f
1009+ 0x0020: 8011 002e 1d02 0000 0101 080a 850b 1f1a
1010+ 0x0030: 7a96 7b52
1011+2013-01-22 09:55:57.793485 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
1012+ 0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
1013+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
1014+ 0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
1015+ 0x0030: 850b 1f1a
1016+2013-01-22 09:55:57.793489 IP 100.0.0.1.3306 > 100.0.0.2.44432: tcp 0
1017+ 0x0000: 4508 0034 268d 4000 4006 8565 0a1c bd49
1018+ 0x0010: 0a1c bd48 0cea ad90 bcdd 5e4f af89 ab83
1019+ 0x0020: 8011 002e 0e16 0000 0101 080a 7a96 8a3d
1020+ 0x0030: 850b 1f1a
1021+2013-01-22 09:55:57.793529 IP 100.0.0.2.44432 > 100.0.0.1.3306: tcp 0
1022+ 0x0000: 4510 0034 bbb2 4000 4006 f037 0a1c bd48
1023+ 0x0010: 0a1c bd49 ad90 0cea af89 ab83 bcdd 5e50
1024+ 0x0020: 8010 002e 0e15 0000 0101 080a 850b 1f1b
1025+ 0x0030: 7a96 8a3d
1026+
1027
1028=== modified file 't/pt-query-digest/mysql_analyses.t'
1029--- t/pt-query-digest/mysql_analyses.t 2012-11-21 16:58:40 +0000
1030+++ t/pt-query-digest/mysql_analyses.t 2013-02-01 18:00:43 +0000
1031@@ -9,7 +9,7 @@
1032 use strict;
1033 use warnings FATAL => 'all';
1034 use English qw(-no_match_vars);
1035-use Test::More tests => 6;
1036+use Test::More;
1037
1038 use PerconaTest;
1039
1040@@ -77,6 +77,30 @@
1041 );
1042
1043 # #############################################################################
1044+# Bug 1103045: pt-query-digest fails to parse non-SQL errors
1045+# https://bugs.launchpad.net/percona-toolkit/+bug/1103045
1046+# #############################################################################
1047+ok(
1048+ no_diff(
1049+ sub { pt_query_digest::main(@args, $sample.'tcpdump043.txt',
1050+ '--report-format', 'header,query_report,profile',
1051+ qw(--watch-server 127.0.0.1:12345)) },
1052+ "t/pt-query-digest/samples/tcpdump043_report.txt"
1053+ ),
1054+ 'Analysis for tcpdump043 with connection error (bug 1103045)'
1055+);
1056+
1057+ok(
1058+ no_diff(
1059+ sub { pt_query_digest::main(@args, $sample.'tcpdump044.txt',
1060+ '--report-format', 'header,query_report,profile',
1061+ qw(--watch-server 100.0.0.1)) },
1062+ "t/pt-query-digest/samples/tcpdump044_report.txt"
1063+ ),
1064+ 'Analysis for tcpdump044 with connection error (bug 1103045)'
1065+);
1066+
1067+# #############################################################################
1068 # Done.
1069 # #############################################################################
1070-exit;
1071+done_testing;
1072
1073=== modified file 't/pt-query-digest/samples/tcpdump001.txt'
1074--- t/pt-query-digest/samples/tcpdump001.txt 2011-06-24 22:02:05 +0000
1075+++ t/pt-query-digest/samples/tcpdump001.txt 2013-02-01 18:00:43 +0000
1076@@ -12,7 +12,6 @@
1077 # Query size 100 32 32 32 32 32 0 32
1078 # Warning coun 0 0 0 0 0 0 0 0
1079 # String:
1080-# Errors none
1081 # Hosts 127.0.0.1
1082 # Query_time distribution
1083 # 1us
1084
1085=== modified file 't/pt-query-digest/samples/tcpdump002_report.txt'
1086--- t/pt-query-digest/samples/tcpdump002_report.txt 2011-06-24 22:02:05 +0000
1087+++ t/pt-query-digest/samples/tcpdump002_report.txt 2013-02-01 18:00:43 +0000
1088@@ -13,7 +13,6 @@
1089 # Warning coun 0 0 0 0 0 0 0 0
1090 # String:
1091 # Databases mysql
1092-# Errors none
1093 # Hosts 127.0.0.1
1094 # Users msandbox
1095 # Query_time distribution
1096@@ -41,7 +40,6 @@
1097 # Warning coun 0 0 0 0 0 0 0 0
1098 # String:
1099 # Databases mysql
1100-# Errors none
1101 # Hosts 127.0.0.1
1102 # Users msandbox
1103 # Query_time distribution
1104@@ -70,7 +68,6 @@
1105 # Warning coun 0 0 0 0 0 0 0 0
1106 # String:
1107 # Databases mysql
1108-# Errors none
1109 # Hosts 127.0.0.1
1110 # Users msandbox
1111 # Query_time distribution
1112@@ -99,7 +96,6 @@
1113 # Warning coun 0 0 0 0 0 0 0 0
1114 # String:
1115 # Databases mysql
1116-# Errors none
1117 # Hosts 127.0.0.1
1118 # Users msandbox
1119 # Query_time distribution
1120
1121=== modified file 't/pt-query-digest/samples/tcpdump012.txt'
1122--- t/pt-query-digest/samples/tcpdump012.txt 2011-06-24 22:02:05 +0000
1123+++ t/pt-query-digest/samples/tcpdump012.txt 2013-02-01 18:00:43 +0000
1124@@ -12,7 +12,6 @@
1125 # Query size 100 32 32 32 32 32 0 32
1126 # Warning coun 0 0 0 0 0 0 0 0
1127 # String:
1128-# Errors none
1129 # Hosts 127.0.0.1
1130 # Query_time distribution
1131 # 1us
1132
1133=== modified file 't/pt-query-digest/samples/tcpdump017_report.txt'
1134--- t/pt-query-digest/samples/tcpdump017_report.txt 2011-06-24 22:02:05 +0000
1135+++ t/pt-query-digest/samples/tcpdump017_report.txt 2013-02-01 18:00:43 +0000
1136@@ -21,7 +21,6 @@
1137 # Query size 100 128 32 32 32 32 0 32
1138 # Warning coun 0 0 0 0 0 0 0 0
1139 # String:
1140-# Errors none
1141 # Hosts 127.0.0.1
1142 # Query_time distribution
1143 # 1us
1144
1145=== modified file 't/pt-query-digest/samples/tcpdump021.txt'
1146--- t/pt-query-digest/samples/tcpdump021.txt 2011-06-24 22:02:05 +0000
1147+++ t/pt-query-digest/samples/tcpdump021.txt 2013-02-01 18:00:43 +0000
1148@@ -12,7 +12,6 @@
1149 # Query size 35 35 35 35 35 35 0 35
1150 # Warning coun 0 0 0 0 0 0 0 0
1151 # String:
1152-# Errors none
1153 # Hosts 127.0.0.1
1154 # Statement id 2
1155 # Query_time distribution
1156@@ -47,7 +46,6 @@
1157 # Boolean:
1158 # No index use 100% yes, 0% no
1159 # String:
1160-# Errors none
1161 # Hosts 127.0.0.1
1162 # Statement id 2
1163 # Query_time distribution
1164@@ -80,7 +78,6 @@
1165 # Query size 27 27 27 27 27 27 0 27
1166 # Warning coun 0 0 0 0 0 0 0 0
1167 # String:
1168-# Errors none
1169 # Hosts 127.0.0.1
1170 # Query_time distribution
1171 # 1us
1172
1173=== modified file 't/pt-query-digest/samples/tcpdump022.txt'
1174--- t/pt-query-digest/samples/tcpdump022.txt 2011-06-24 22:02:05 +0000
1175+++ t/pt-query-digest/samples/tcpdump022.txt 2013-02-01 18:00:43 +0000
1176@@ -12,7 +12,6 @@
1177 # Query size 47 46 46 46 46 46 0 46
1178 # Warning coun 0 0 0 0 0 0 0 0
1179 # String:
1180-# Errors none
1181 # Hosts 127.0.0.1
1182 # Statement id 2
1183 # Query_time distribution
1184@@ -45,7 +44,6 @@
1185 # Query size 52 51 51 51 51 51 0 51
1186 # Warning coun 0 0 0 0 0 0 0 0
1187 # String:
1188-# Errors none
1189 # Hosts 127.0.0.1
1190 # Statement id 2
1191 # Query_time distribution
1192
1193=== modified file 't/pt-query-digest/samples/tcpdump023.txt'
1194--- t/pt-query-digest/samples/tcpdump023.txt 2011-06-24 22:02:05 +0000
1195+++ t/pt-query-digest/samples/tcpdump023.txt 2013-02-01 18:00:43 +0000
1196@@ -12,7 +12,6 @@
1197 # Query size 42 50 50 50 50 50 0 50
1198 # Warning coun 0 0 0 0 0 0 0 0
1199 # String:
1200-# Errors none
1201 # Hosts 127.0.0.1
1202 # Statement id 2
1203 # Query_time distribution
1204@@ -45,7 +44,6 @@
1205 # Query size 57 69 69 69 69 69 0 69
1206 # Warning coun 0 0 0 0 0 0 0 0
1207 # String:
1208-# Errors none
1209 # Hosts 127.0.0.1
1210 # Statement id 2
1211 # Query_time distribution
1212
1213=== modified file 't/pt-query-digest/samples/tcpdump024.txt'
1214--- t/pt-query-digest/samples/tcpdump024.txt 2011-06-24 22:02:05 +0000
1215+++ t/pt-query-digest/samples/tcpdump024.txt 2013-02-01 18:00:43 +0000
1216@@ -12,7 +12,6 @@
1217 # Query size 45 50 50 50 50 50 0 50
1218 # Warning coun 0 0 0 0 0 0 0 0
1219 # String:
1220-# Errors none
1221 # Hosts 127.0.0.1
1222 # Statement id 2
1223 # Query_time distribution
1224@@ -45,7 +44,6 @@
1225 # Query size 54 59 59 59 59 59 0 59
1226 # Warning coun 0 0 0 0 0 0 0 0
1227 # String:
1228-# Errors none
1229 # Hosts 127.0.0.1
1230 # Statement id 2
1231 # Query_time distribution
1232
1233=== modified file 't/pt-query-digest/samples/tcpdump025.txt'
1234--- t/pt-query-digest/samples/tcpdump025.txt 2011-06-24 22:02:05 +0000
1235+++ t/pt-query-digest/samples/tcpdump025.txt 2013-02-01 18:00:43 +0000
1236@@ -12,7 +12,6 @@
1237 # Query size 50 42 42 42 42 42 0 42
1238 # Warning coun 0 0 0 0 0 0 0 0
1239 # String:
1240-# Errors none
1241 # Hosts 127.0.0.1
1242 # Statement id 2
1243 # Query_time distribution
1244@@ -47,7 +46,6 @@
1245 # Boolean:
1246 # No index use 100% yes, 0% no
1247 # String:
1248-# Errors none
1249 # Hosts 127.0.0.1
1250 # Statement id 2
1251 # Query_time distribution
1252
1253=== modified file 't/pt-query-digest/samples/tcpdump033.txt'
1254--- t/pt-query-digest/samples/tcpdump033.txt 2011-06-24 22:02:05 +0000
1255+++ t/pt-query-digest/samples/tcpdump033.txt 2013-02-01 18:00:43 +0000
1256@@ -25,7 +25,6 @@
1257 # Boolean:
1258 # No index use 100% yes, 0% no
1259 # String:
1260-# Errors none
1261 # Hosts 127.0.0.1
1262 # Statement id 2 (3/42%), 3 (2/28%), 4 (1/14%), 5 (1/14%)
1263 # Query_time distribution
1264@@ -58,7 +57,6 @@
1265 # Query size 37 217 42 45 43.40 44.60 1.31 42.48
1266 # Warning coun 0 0 0 0 0 0 0 0
1267 # String:
1268-# Errors none
1269 # Hosts 127.0.0.1
1270 # Statement id 2 (1/20%), 3 (1/20%), 4 (1/20%), 5 (1/20%)... 1 more
1271 # Query_time distribution
1272@@ -91,7 +89,6 @@
1273 # Query size 10 60 20 20 20 20 0 20
1274 # Warning coun 0 0 0 0 0 0 0 0
1275 # String:
1276-# Errors none
1277 # Hosts 127.0.0.1
1278 # Query_time distribution
1279 # 1us
1280
1281=== modified file 't/pt-query-digest/samples/tcpdump041.txt'
1282--- t/pt-query-digest/samples/tcpdump041.txt 2011-11-08 19:53:50 +0000
1283+++ t/pt-query-digest/samples/tcpdump041.txt 2013-02-01 18:00:43 +0000
1284@@ -21,7 +21,6 @@
1285 # Query size 100 35 35 35 35 35 0 35
1286 # Warning coun 0 0 0 0 0 0 0 0
1287 # String:
1288-# Errors none
1289 # Hosts 127.0.0.1
1290 # Statement id 2
1291 # Query_time distribution
1292
1293=== added file 't/pt-query-digest/samples/tcpdump043_report.txt'
1294--- t/pt-query-digest/samples/tcpdump043_report.txt 1970-01-01 00:00:00 +0000
1295+++ t/pt-query-digest/samples/tcpdump043_report.txt 2013-02-01 18:00:43 +0000
1296@@ -0,0 +1,41 @@
1297+
1298+# Overall: 1 total, 1 unique, 0 QPS, 0x concurrency ______________________
1299+# Time range: all events occurred at 2013-01-24 13:03:28.672987
1300+# Attribute total min max avg 95% stddev median
1301+# ============ ======= ======= ======= ======= ======= ======= =======
1302+# Exec time 4s 4s 4s 4s 4s 0 4s
1303+# Rows affecte 0 0 0 0 0 0 0
1304+# Query size 30 30 30 30 30 0 30
1305+# Warning coun 0 0 0 0 0 0 0
1306+
1307+# Query 1: 0 QPS, 0x concurrency, ID 0x5D51E5F01B88B79E at byte 0 ________
1308+# This item is included in the report because it matches --limit.
1309+# Scores: Apdex = 0.50 [1.0]*, V/M = 0.00
1310+# Query_time sparkline: | ^ |
1311+# Time range: all events occurred at 2013-01-24 13:03:28.672987
1312+# Attribute pct total min max avg 95% stddev median
1313+# ============ === ======= ======= ======= ======= ======= ======= =======
1314+# Count 100 1
1315+# Exec time 100 4s 4s 4s 4s 4s 0 4s
1316+# Rows affecte 0 0 0 0 0 0 0 0
1317+# Query size 100 30 30 30 30 30 0 30
1318+# Warning coun 0 0 0 0 0 0 0 0
1319+# String:
1320+# Error msg Got packets out of order
1321+# Errors 1156
1322+# Hosts 127.0.0.1
1323+# Query_time distribution
1324+# 1us
1325+# 10us
1326+# 100us
1327+# 1ms
1328+# 10ms
1329+# 100ms
1330+# 1s ################################################################
1331+# 10s+
1332+administrator command: Connect\G
1333+
1334+# Profile
1335+# Rank Query ID Response time Calls R/Call Apdx V/M Item
1336+# ==== ================== ============= ===== ====== ==== ===== ==========
1337+# 1 0x5D51E5F01B88B79E 3.5363 100.0% 1 3.5363 0.50 0.00 ADMIN CONNECT
1338
1339=== added file 't/pt-query-digest/samples/tcpdump044_report.txt'
1340--- t/pt-query-digest/samples/tcpdump044_report.txt 1970-01-01 00:00:00 +0000
1341+++ t/pt-query-digest/samples/tcpdump044_report.txt 2013-02-01 18:00:43 +0000
1342@@ -0,0 +1,40 @@
1343+
1344+# Overall: 1 total, 1 unique, 0 QPS, 0x concurrency ______________________
1345+# Time range: all events occurred at 2013-01-22 09:55:57.793375
1346+# Attribute total min max avg 95% stddev median
1347+# ============ ======= ======= ======= ======= ======= ======= =======
1348+# Exec time 4s 4s 4s 4s 4s 0 4s
1349+# Rows affecte 0 0 0 0 0 0 0
1350+# Query size 30 30 30 30 30 0 30
1351+# Warning coun 0 0 0 0 0 0 0
1352+
1353+# Query 1: 0 QPS, 0x concurrency, ID 0x5D51E5F01B88B79E at byte 0 ________
1354+# This item is included in the report because it matches --limit.
1355+# Scores: Apdex = 0.50 [1.0]*, V/M = 0.00
1356+# Query_time sparkline: | ^ |
1357+# Time range: all events occurred at 2013-01-22 09:55:57.793375
1358+# Attribute pct total min max avg 95% stddev median
1359+# ============ === ======= ======= ======= ======= ======= ======= =======
1360+# Count 100 1
1361+# Exec time 100 4s 4s 4s 4s 4s 0 4s
1362+# Rows affecte 0 0 0 0 0 0 0 0
1363+# Query size 100 30 30 30 30 30 0 30
1364+# Warning coun 0 0 0 0 0 0 0 0
1365+# String:
1366+# Error msg Client closed connection during handshake
1367+# Hosts 100.0.0.2
1368+# Query_time distribution
1369+# 1us
1370+# 10us
1371+# 100us
1372+# 1ms
1373+# 10ms
1374+# 100ms
1375+# 1s ################################################################
1376+# 10s+
1377+administrator command: Connect\G
1378+
1379+# Profile
1380+# Rank Query ID Response time Calls R/Call Apdx V/M Item
1381+# ==== ================== ============= ===== ====== ==== ===== ==========
1382+# 1 0x5D51E5F01B88B79E 3.8195 100.0% 1 3.8195 0.50 0.00 ADMIN CONNECT

Subscribers

People subscribed via source and target branches