Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to log queries to database #424

Open
wants to merge 2 commits into
base: 3.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion bin/pt-kill
Original file line number Diff line number Diff line change
Expand Up @@ -7379,6 +7379,17 @@ sub main {
exec_cmd($o->get('execute-command'));
msg('Executed ' . $o->get('execute-command'));
}
if ( $o->get('logdb') ) {
if ( $log ) {
log_to_table(
log => $log,
query => $query,
proclist => $pl,
columns => \@processlist_columns,
eval_error => $EVAL_ERROR,
);
}
}
if ( $o->get('kill') || $o->get('kill-query') ) {
if ( $o->get('wait-before-kill') ) {
msg("Sleeping " . $o->get('wait-before-kill')
Expand Down Expand Up @@ -7673,7 +7684,7 @@ with the command.

=head1 OPTIONS

Specify at least one of L<"--kill">, L<"--kill-query">, L<"--print">, L<"--execute-command"> or L<"--stop">.
Specify at least one of L<"--kill">, L<"--kill-query">, L<"--logdb">,L<"--print">, L<"--execute-command"> or L<"--stop">.

L<"--any-busy-time"> and L<"--each-busy-time"> are mutually exclusive.

Expand Down Expand Up @@ -8382,6 +8393,17 @@ This option makes pt-kill kill matching queries. This requires MySQL 5.0 or
newer. Unlike L<"--kill"> which kills the connection for matching queries,
this option only kills the query, not its connection.

=item --logdb

group: Actions

Logs a KILL statement for matching queries to the database using --log-dsn;
does not actually kill queries.

If you just want to see which queries match and would be killed without
actually killing them, specify L<"--logdb">. To both kill and print
matching queries, specify L<"--kill"> instead.

=item --print

group: Actions
Expand Down