pt-query-digest and 5.6 binlog

Hi

We are trying to use pt-query-digest on a binlog from MySQL 5.6.16 but it looks like it can’t parse the binlog file. We have converted the binlog with “mysqlbinlog ***.bin > kglabb.sql” and when we run pt-query-digest this is what we get:

pt-query-digest --type binlog kglabb.sql
kglabb.sql: 100% 00:00 remain

155.9s user time, 4s system time, 24.41M rss, 205.23M vsz

Current date: Wed Mar 12 14:33:11 2014

Hostname: SEGUM-MGMT-01.host.core.intra

Files: kglabb.sql

Overall: 0 total, 1 unique, 0 QPS, 0x concurrency ______________________

Time range: unknown

Attribute total min max avg 95% stddev median

============ ======= ======= ======= ======= ======= ======= =======

Query size 132 132 132 132 132 0 132

Profile

Rank Query ID Response time Calls R/Call V/M Item

=========== =========== =========== =========== =========== ===== ======

When we run it with PTDEBUG=1 we get a “Unknown event type: CRC32” for each event in the logfile.

We are running: pt-query-digest 2.2.5

What are we doing wrong? Or is this expected behavior to not be able to use 5.6 binlogs with pt-query-digest?

Brgds
Olof Mattsson

Hi,

Can you provide output of “mysqlbinlog --version” and “show variables” ? I think that event type CRC32 is new for 5.6 binlog, it was not in 5.5.

It seems the CRC32 checksum was added in MySQL 5.6. The following change works for me:


--- pt-query-digest.old 2014-04-03 11:41:04.000000000 +0200
+++ pt-query-digest 2014-04-03 23:55:46.000000000 +0200
@@ -9580,7 +9580,7 @@
$Data::Dumper::Quotekeys = 0;

my $binlog_line_1 = qr/at (\d+)$/m;
-my $binlog_line_2 = qr/^#(\d{6}\s+\d{1,2}:\d\d:\d\d)\s+server\s+id\s+(\d+)\s+end_log_pos\s+(\d+)\s+(\S+)\s*([^\n]*)$/m;
+my $binlog_line_2 = qr/^#(\d{6}\s+\d{1,2}:\d\d:\d\d)\s+server\s+id\s+(\d+)\s+end_log_pos\s+(\d+)\s+CRC32\s+[0-9a-fx]{10}\s+(\S+)\s*([^\n]*)$/m;
my $binlog_line_2_rest = qr/thread_id=(\d+)\s+exec_time=(\d+)\s+error_code=(\d+)/m;

sub new {

HI,
Yes its new in 5.6. We run 5.6.16 at the moment.

mysqlbinlog --version
mysqlbinlog Ver 3.4 for Linux at x86_64

Brgds