Parse InnoDB_trx_id as a string.

This commit is contained in:
Daniel Nichter
2012-02-23 09:34:17 -07:00
parent bb7890d78d
commit a83e97a821
5 changed files with 103 additions and 10 deletions

View File

@@ -13099,6 +13099,7 @@ sub main {
Error_no => 'string', Error_no => 'string',
Last_errno => 'string', Last_errno => 'string',
Thread_id => 'string', Thread_id => 'string',
InnoDB_trx_id => 'string',
Killed => 'bool', Killed => 'bool',
}; };

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Test::More tests => 80; use Test::More tests => 81;
use QueryRewriter; use QueryRewriter;
use EventAggregator; use EventAggregator;
@@ -1906,6 +1906,24 @@ cmp_ok(
"Saved no more than 1_000 CRCs" "Saved no more than 1_000 CRCs"
); );
# #############################################################################
# Bug 821694: pt-query-digest doesn't recognize hex InnoDB txn IDs
# #############################################################################
$ea = new EventAggregator(
groupby => 'arg',
worst => 'Query_time',
unroll_limit => 5,
type_for => {
'InnoDB_trx_id' => 'string',
},
);
parse_file('t/lib/samples/slowlogs/slow054.txt', $p, $ea);
is(
$ea->{result_classes}->{'SELECT * FROM foo WHERE id=1'}->{InnoDB_trx_id}->{cnt},
8,
"Parse InnoDB_trx_id as string"
);
# ############################################################################# # #############################################################################
# Done. # Done.
# ############################################################################# # #############################################################################

View File

@@ -0,0 +1,32 @@
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 101
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 102
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 103
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 104
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 105
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: 106
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: A07
SELECT * FROM foo WHERE id=1;
# Time: 110208 12:00:01
# Query_time: 0.000012 Lock_time: 0.000000 Rows_sent: 0 Rows_examined: 0
# InnoDB_trx_id: A08
SELECT * FROM foo WHERE id=1;

View File

@@ -0,0 +1,30 @@
# Query 1: 0 QPS, 0x concurrency, ID 0xBB11C6B7F3BAAB30 at byte 1058 _____
# 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 2011-02-08 12:00:01
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 100 8
# Exec time 100 96us 12us 12us 12us 12us 0 12us
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 100 224 28 28 28 28 0 28
# String:
# InnoDB trxID 101 (1/12%), 102 (1/12%), 103 (1/12%)... 5 more
# Query_time distribution
# 1us
# 10us ################################################################
# 100us
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
# Tables
# SHOW TABLE STATUS LIKE 'foo'\G
# SHOW CREATE TABLE `foo`\G
# EXPLAIN /*!50100 PARTITIONS*/
SELECT * FROM foo WHERE id=1\G

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict; use strict;
use warnings FATAL => 'all'; use warnings FATAL => 'all';
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Test::More tests => 42; use Test::More tests => 43;
use PerconaTest; use PerconaTest;
@@ -421,6 +421,18 @@ ok(
'Analysis for slow052 (Apdex T = 0.1)', 'Analysis for slow052 (Apdex T = 0.1)',
); );
# #############################################################################
# Bug 821694: pt-query-digest doesn't recognize hex InnoDB txn IDs
# #############################################################################
ok(
no_diff(
sub { pt_query_digest::main(@args, $sample.'slow054.txt',
qw(--check-attributes-limit 5)) },
"t/pt-query-digest/samples/slow054.txt",
),
'Analysis for slow054 (InnoDB_trx_id bug 821694)'
);
# ############################################################################# # #############################################################################
# Done. # Done.
# ############################################################################# # #############################################################################