Search code examples
mariadbtoolkitperconaubuntu-16.04

Pipeline process 5 (iteration) caused an error: Redundant argument in sprintf at /usr/bin/pt-query-digest line 2556


I am using percona-toolkit for analysing mysql-slow-query (logs). So the command is pretty basic:

pt-query-digest slowquery.log

Now the result(error) is:

18.2s user time, 100ms system time, 35.61M rss, 105.19M vsz

Current date: Thu Jul 7 17:18:43 2016

Hostname: Jammer

Files: slowquery.log

Pipeline process 5 (iteration) caused an error: Redundant argument in sprintf at /usr/bin/pt-query-digest line 2556. Will retry pipeline process 4 (iteration) 2 more times.

.. ..(same result prints twice) ..

The pipeline caused an error: Pipeline process 5 (iteration) caused an error: Redundant argument in sprintf at /usr/bin/pt-query-digest line 2556. Terminating pipeline because process 4 (iteration) caused too many errors.

Now the specifics for the environment, I am using Ubuntu 16.04 , MariaDB 10.1.14, Percona-Toolkit 2.2.16

I found something here bug-report, but it is like a workaround and does not actually solve the error. Even after applying the patch the command result doesn't look satisfying enough.


I am facing same problem on ubuntu 16.04 MySql. The contents of my slow query log is as follow.

/usr/sbin/mysqld, Version: 5.7.16-0ubuntu0.16.04.1-log ((Ubuntu)). started with: Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock Time Id Command Argument /usr/sbin/mysqld, Version: 5.7.16-0ubuntu0.16.04.1-log ((Ubuntu)). started with: Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock Time Id Command Argument Time: 2016-12-08T05:13:55.140764Z User@Host: root[root] @ localhost [] Id: 20 Query_time: 0.003770 Lock_time: 0.000200 Rows_sent: 1 Rows_examined: 2 SET timestamp=1481174035; SELECT COUNT(*) FROM INFORMATION_SCHEMA.TRIGGERS;

The error is same:

The pipeline caused an error: Pipeline process 5 (iteration) caused an error: Redundant argument in sprintf at /usr/bin/pt-query-digest line 2556.

Ubuntu 16.04 MySql Ver 14.14 Distrib 5.7.16 pt-query-digest 2.2.16


Solution

  • The bug appears to be fixed in the current version of the toolkit (2.2.20), and apparently in previous ones, starting from 2.2.17.

    This patch seems to do the trick for this particular place in pt-query-digest:

    --- percona-toolkit-2.2.16/bin/pt-query-digest  2015-11-06 14:56:23.000000000 -0500
    +++ percona-toolkit-2.2.20/bin/pt-query-digest  2016-12-06 17:01:51.000000000 -0500
    @@ -2555,8 +2583,8 @@
        }
        return sprintf(
           $num =~ m/\./ || $n
    -         ? "%.${p}f%s"
    -         : '%d',
    +         ? '%1$.'.$p.'f%2$s'
    +         : '%1$d',
           $num, $units[$n]);
     }
    

    But as mentioned in the original question and bug report, quite a few tools/functions were affected, the full bugfix consisted of a lot of small changes: https://github.com/percona/percona-toolkit/pull/73/files