Fix prepared report for statements without corresponding prep or exec.

This commit is contained in:
Daniel Nichter
2011-11-08 12:53:50 -07:00
parent 4f1fa405b7
commit 2f9ab4081a
9 changed files with 200 additions and 19 deletions

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 6;
use Test::More tests => 7;
use PerconaTest;
@@ -69,6 +69,18 @@ ok(
'Analysis for tcpdump033 with prepared statements report'
);
# ############################################################################
# Bug 887688: Prepared statements crash pt-query-digest
# ############################################################################
ok(
no_diff(
sub { pt_query_digest::main(@args, $sample.'tcpdump041.txt',
'--report-format', 'header,query_report,profile,prepared') },
"t/pt-query-digest/samples/tcpdump041.txt",
),
'Analysis for tcpdump041 (bug 887688)'
);
# #############################################################################
# Done.
# #############################################################################

View File

@@ -0,0 +1,52 @@
# Overall: 1 total, 1 unique, 0 QPS, 0x concurrency ______________________
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 286us 286us 286us 286us 286us 0 286us
# Rows affecte 0 0 0 0 0 0 0
# Query size 35 35 35 35 35 0 35
# Warning coun 0 0 0 0 0 0 0
# Query 1: 0 QPS, 0x concurrency, ID 0xAA8E9FA785927259 at byte 0 ________
# This item is included in the report because it matches --limit.
# Scores: Apdex = 1.00 [1.0]*, V/M = 0.00
# Query_time sparkline: | ^ |
# Time range: all events occurred at 2009-12-08 09:23:49.637394
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 1
# Exec time 100 286us 286us 286us 286us 286us 0 286us
# Rows affecte 0 0 0 0 0 0 0 0
# Query size 100 35 35 35 35 35 0 35
# Warning coun 0 0 0 0 0 0 0 0
# String:
# Errors none
# Hosts 127.0.0.1
# Statement id 2
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS FROM `d` LIKE 't'\G
# SHOW CREATE TABLE `d`.`t`\G
PREPARE SELECT i FROM d.t WHERE i=?\G
# Converted for EXPLAIN
# EXPLAIN /*!50100 PARTITIONS*/
SELECT i FROM d.t WHERE i=?\G
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== ============= ===== ====== ==== ===== ==========
# 1 0xAA8E9FA785927259 0.0003 100.0% 1 0.0003 1.00 0.00 SELECT d.t
# Prepared statements
# Rank Query ID PREP PREP Response EXEC EXEC Response Item
# ==== ================== ==== ============= ==== ============= ==========
# 1 0xAA8E9FA785927259 1 0.0003 100.0% 0 0.0000 0.0% SELECT d.t