used Transformers::make_checksum. Changed option to --query-id

This commit is contained in:
Frank Cizmich
2015-01-12 15:22:23 -02:00
parent 324a086d6a
commit 5251b00a9a
2 changed files with 20 additions and 11 deletions

View File

@@ -7102,10 +7102,10 @@ sub main {
$query->{Id}, ($query->{Command} || 'NULL'), $query->{Time},
($query->{Info} || 'NULL');
}
if ( $o->get('fingerprint') ) {
if ( $o->get('query-id') ) {
my $fp = $qr->fingerprint($query->{'Info'});
my $chksm = uc substr(md5_hex($fp), -16);
print "Fingerprint: 0x$chksm\n";
my $chksm = Transformers::make_checksum($fp);
print "Query ID: 0x$chksm\n";
}
if ( $o->get('execute-command') ) {
exec_cmd($o->get('execute-command'));
@@ -7493,11 +7493,6 @@ pt-kill does not provide any safeguards so code carefully!
It is permissible for the code to have side effects (to alter C<$event>).
=item --fingerprint
Prints a fingerprint (checksum) of the query that was just killed. This is
equivalent to the fingerprint output of pt-query-digest. This allows
cross-referencing the output of both tools.
=item --group-by
@@ -7602,6 +7597,20 @@ short form: -P; type: int
Port number to use for connection.
=item --query-id
Prints an ID of the query that was just killed. This is
equivalent to the "ID" output of pt-query-digest. This allows
cross-referencing the output of both tools.
Example:
Query ID 0xE9800998ECF8427E
Note that this is a digest (or hash) of the query's "fingerprint",
so queries of the same form but with different values will have the same ID.
See pt-query-digest for more information.
=item --run-time
type: time

View File

@@ -137,14 +137,14 @@ like(
"--match-all"
);
# --fingerprint option
# --query-id option
$output = output(
sub { pt_kill::main(@args, "$trunk/t/lib/samples/pl/recset011.txt", qw(--match-all --print --fingerprint)); }
sub { pt_kill::main(@args, "$trunk/t/lib/samples/pl/recset011.txt", qw(--match-all --print --query-id)); }
);
like(
$output,
qr/0x69962191E64980E6/,
'--fingerprint'
'--query-id'
);
# #############################################################################