LP #1028614: pt-index-usage ignores --database

Description

**Reported in Launchpad by Bryan Aldridge last update 10-08-2012 18:16:24

Using output of "pt-query-digest --type tcpdump --no-report --print" as input to pt-index-usage with the --database option does not work. pt-index-usage connects to the "mysql" database, and attempts to change that with -D or --database option does not help.

Errors similar to ...

"DBD::mysql::db selectall_arrayref failed: Table 'mysql.<table name in other database>' doesn't exist [for Statement "EXPLAIN SELECT....."]

...are thrown for each query in the file produced by pt-query-digest after calling pt-index-usage.

Using percona-toolkit-2.1.2-1.noarch on Red Hat Enterprise Linux 5.8, MySQL 5.5.22 server and client.

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 24, 2018 at 3:47 PM

**Comment from Launchpad by: Daniel Nichter on: 28-07-2012 20:02:02

This was supposedly fixed for http://code.google.com/p/maatkit/issues/detail?id=1140 and there's a test case, but apparently it's not a very good test case.

lpjirasync January 24, 2018 at 3:47 PM

**Comment from Launchpad by: Daniel Nichter on: 28-07-2012 19:59:46

I can reproduce this:

$ ./pt-index-usage --database sakila ../t/pt-index-usage/samples/slow006.txt -h 127.1 -P 12345 -u msandbox -p msandbox
DBD::mysql::db selectall_arrayref failed: Table 'z.film_text' doesn't exist [for Statement "EXPLAIN select * from film_text"] at ./pt-index-usage line 4263, <> line 1.

The --database (-D) works, but the tool isn't restoring it after it gets SHOW CREATE TABLE defs for tables from other dbs. So in the above, the "z" database is the last db the tool accesses, leaving it as the current db.

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 24, 2018 at 3:47 PM
Updated January 24, 2018 at 3:47 PM
Resolved January 24, 2018 at 3:47 PM

Flag notifications