pt-query-digest fails to parse non-SQL errors
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Fix Released
|
High
|
Daniel Nichter |
Bug Description
When using the tcpdump mode with pt-query-digest to troubleshoot failed connections to the database, I noticed that there are certain situations where it would not show the connections that were failing. If you try to connect with bad password it would show the failed connection in the report, but if you do a `telnet dbserver 3306`, it does not print the connect error in the report.
How to recreate:
Start tcpdump.
sudo /usr/sbin/tcpdump -i any port 3306 -s 65535 -x -nn -q -tttt > server.tcpdump
"Connect to mysql"
telnet dbserver 3306
Disconnect from mysql
Stop tcpdump
Run report
cat server.tcpdump | pt-query-digest --type tcpdump --show-all host --limit 100% --inherit-
pt-query-digest 2.1.7
Related branches
- Daniel Nichter: Approve
-
Diff: 1382 lines (+502/-105)20 files modifiedbin/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)
summary: |
- pt-query-digest does not report all failed connect to the database + pt-query-digest does not report all failed connections to the database |
tags: | added: tcpdump |
Changed in percona-toolkit: | |
milestone: | none → 2.1.9 |
importance: | Undecided → High |
status: | New → Triaged |
Changed in percona-toolkit: | |
status: | Triaged → In Progress |
assignee: | nobody → Daniel Nichter (daniel-nichter) |
Changed in percona-toolkit: | |
status: | Fix Committed → Fix Released |
There is a bug here: MySQLProtocolPa rser::parser_ error_packet( ) doesn't understand non-SQL errors, i.e. errors that do not have this format:
# Error packet structure: ======= ======= ======= ======= =
# Offset Bytes Field
# ====== ================= =======
# 00 00 00 01 MySQL proto header (already removed)
# ff Error (already removed)
# 0 00 00 Error number
# 4 23 SQL state marker, always '#'
# 6 00 00 00 00 00 SQL state
# 16 00 ... Error message
Connection errors, for example, don't have a SQL state, they have only FF, error number, then error message.