Skip to content

Commit 2c3491e

Browse files
Merge pull request #405 from dreamydb/3.0
PT-2541 - Print database name when logging pt-kill output to file
2 parents 2b49a4d + 189b13e commit 2c3491e

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

bin/pt-kill

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7671,9 +7671,9 @@ sub main {
76717671
}
76727672
printf "%s\n", Transformers::hash_to_json(\%jsonOutput);
76737673
} else {
7674-
printf "# %s %s %d (%s %d sec) %s\n",
7674+
printf "# %s %s %d (Db: %s) (%s %d sec) %s\n",
76757675
ts(time), $o->get('kill-query') ? 'KILL QUERY' : 'KILL',
7676-
$query->{Id}, ($query->{Command} || 'NULL'), $query->{Time},
7676+
$query->{Id}, ($query->{db} || 'NULL'), ($query->{Command} || 'NULL'), $query->{Time},
76777677
$qinfo;
76787678
}
76797679
}

t/pt-kill/group_by.t

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ $output = output(
3232
);
3333
like(
3434
$output,
35-
qr/# \S+ KILL 3 \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 4 \(Query 5 sec\) select c from t where id='foo';/,
35+
qr/# \S+ KILL 3 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 4 \(Db: foo\) \(Query 5 sec\) select c from t where id='foo';/,
3636
"Kill all but oldest"
3737
);
3838

@@ -44,7 +44,7 @@ $output = output(
4444
);
4545
like(
4646
$output,
47-
qr/# \S+ KILL 3 \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Query 9 sec\) select c from t where id='foo';/,
47+
qr/# \S+ KILL 3 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';/,
4848
"Kill all but oldest, matching specific user"
4949
);
5050

@@ -70,7 +70,7 @@ $output = output(
7070
);
7171
like(
7272
$output,
73-
qr/# \S+ KILL 1 \(Query 10 sec\)/,
73+
qr/# \S+ KILL 1 \(Db: foo\) \(Query 10 sec\)/,
7474
"Any busy time matches"
7575
);
7676

@@ -94,7 +94,7 @@ $output = output(
9494
);
9595
like(
9696
$output,
97-
qr/# \S+ KILL 3 \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Query 9 sec\) select c from t where id='foo';/,
97+
qr/# \S+ KILL 3 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';\n# \S+ KILL 2 \(Db: foo\) \(Query 9 sec\) select c from t where id='foo';/,
9898
"Each busy time matches"
9999
);
100100

t/pt-kill/match.t

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $output = output(
3131
);
3232
like(
3333
$output,
34-
qr/KILL 9 \(Query 0 sec\) show processlist/,
34+
qr/KILL 9 \(Db: NULL\) \(Query 0 sec\) show processlist/,
3535
'--match-info'
3636
);
3737

@@ -49,7 +49,7 @@ $output = output(
4949
);
5050
like(
5151
$output,
52-
qr/KILL 2 \(Query 5 sec\) select \* from foo2/,
52+
qr/KILL 2 \(Db: foo\) \(Query 5 sec\) select \* from foo2/,
5353
"Can override default ignore State=Locked with --ignore-state ''"
5454
);
5555

@@ -58,7 +58,7 @@ $output = output(
5858
);
5959
like(
6060
$output,
61-
qr/KILL 29393378 \(Query 3 sec\)/,
61+
qr/KILL 29393378 \(Db: happy\) \(Query 3 sec\)/,
6262
'--match-state'
6363
);
6464

@@ -103,7 +103,7 @@ $output = output(
103103
);
104104
like(
105105
$output,
106-
qr/KILL 29392005 \(Sleep 17 sec\) NULL/,
106+
qr/KILL 29392005 \(Db: happy\) \(Sleep 17 sec\) NULL/,
107107
'--idle-time'
108108
);
109109

@@ -112,7 +112,7 @@ $output = output(
112112
);
113113
like(
114114
$output,
115-
qr/KILL 2 \(Query 9 sec\) select \* from foo2/,
115+
qr/KILL 2 \(Db: foo\) \(Query 9 sec\) select \* from foo2/,
116116
"--match-state Locked --ignore-state '' --busy-time 5"
117117
);
118118

t/pt-kill/pt_167.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ my $output = output(
8080

8181
like(
8282
$output,
83-
qr/KILL $pid \(Execute/,
83+
qr/KILL $pid \(Db: sakila\) \(Execute/,
8484
'--kill-query'
8585
) or diag($output);
8686

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
KILL 4 (Query 6 sec) /* fruit=orange */ select 1 from fuits;
2-
KILL 3 (Query 6 sec) /* fruit=orange */ select 1 from fuits;
1+
KILL 4 (Db: db) (Query 6 sec) /* fruit=orange */ select 1 from fuits;
2+
KILL 3 (Db: db) (Query 6 sec) /* fruit=orange */ select 1 from fuits;

0 commit comments

Comments
 (0)