Skip to content
Merged
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
7 changes: 4 additions & 3 deletions check_postgres.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5501,7 +5501,7 @@ sub check_replication_slots {
WITH slots AS (SELECT slot_name,
slot_type,
coalesce(restart_lsn, '0/0'::pg_lsn) AS slot_lsn,
coalesce(pg_xlog_location_diff(pg_current_xlog_location(), restart_lsn),0) AS delta,
coalesce(pg_xlog_location_diff(coalesce(pg_last_xlog_receive_location(), pg_current_xlog_location()), restart_lsn),0) AS delta,
active
FROM pg_replication_slots)
SELECT *, pg_size_pretty(delta) AS delta_pretty FROM slots;
Expand All @@ -5510,8 +5510,9 @@ sub check_replication_slots {
if ($opt{perflimit}) {
$SQL .= " ORDER BY 1 DESC LIMIT $opt{perflimit}";
}
my $SQL10;
($SQL10 = $SQL) =~ s/xlog_location/wal_lsn/g;
my $SQL10 = $SQL;
$SQL10 =~ s/xlog_location/wal_lsn/g;
$SQL10 =~ s/xlog_receive_location/wal_receive_lsn/g;

my $info = run_command($SQL, { regex => qr{\d+}, emptyok => 1, version => [">9.6 $SQL10"] } );
my $found = 0;
Expand Down