Skip to content

Commit

Permalink
Update show_why_sync_killed().
Browse files Browse the repository at this point in the history
At least I think so. It was still querying `bucardo.q`, which was removed in
 0763c28. I replaced its calls with the columns that look more or less
 parallel, although `pid` is gone. A review would be appreciated.

I got errors about it not working while running failing tests. Still trying to
chase down the underlying failures...
  • Loading branch information
theory committed Oct 19, 2012
1 parent 8c601d7 commit cc964ac
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions bucardo
Original file line number Diff line number Diff line change
Expand Up @@ -4919,12 +4919,10 @@ sub show_why_sync_killed {
my $sync = shift;

$SQL = q{
SELECT * FROM bucardo.q
SELECT * FROM bucardo.syncrun
WHERE sync = ?
AND aborted IS NOT NULL
AND LENGTH(whydie) > 2
AND aborted >= now() - '30 seconds'::interval
ORDER BY aborted DESC LIMIT 1
AND lastbad
ORDER BY started DESC LIMIT 1
};
$sth = $dbh->prepare($SQL);
$count = $sth->execute($sync);
Expand All @@ -4934,12 +4932,12 @@ ORDER BY aborted DESC LIMIT 1
}

my $result = $sth->fetchall_arrayref({})->[0];
(my $whydie = $result->{whydie}) =~ s/\\n */\n /g;
(my $whydie = $result->{details}) =~ s/\\n */\n /g;
$whydie =~ s/: ERROR:/:\n ERROR:/;
$whydie =~ s/ (at .+ line \d+\.)/\n $1/g;
$whydie =~ s/\t/<tab>/g;
my $message = sprintf " PID: %s\n Started: %s\n Ended: %s\n %s",
$result->{pid}, $result->{started}, $result->{aborted}, $whydie;
my $message = sprintf " Started: %s\n Ended: %s\n %s",
$result->{pid}, $result->{started}, $result->{ended}, $whydie;

return $message;

Expand Down

0 comments on commit cc964ac

Please sign in to comment.