Skip to content

Commit 5ade2a3

Browse files
committed
Support check_hot_standby_delay for PG10
1 parent ca1f541 commit 5ade2a3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

check_postgres.pl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5111,7 +5111,12 @@ sub check_hot_standby_delay {
51115111
my ($moffset, $s_rec_offset, $s_rep_offset, $time_delta);
51125112

51135113
## On slave
5114-
$SQL = q{SELECT pg_last_xlog_receive_location() AS receive, pg_last_xlog_replay_location() AS replay};
5114+
if ($version >= 10) {
5115+
$SQL = q{SELECT pg_last_wal_receive_lsn() AS receive, pg_last_wal_replay_lsn() AS replay};
5116+
}
5117+
else {
5118+
$SQL = q{SELECT pg_last_xlog_receive_location() AS receive, pg_last_xlog_replay_location() AS replay};
5119+
}
51155120
if ($version >= 9.1) {
51165121
$SQL .= q{, COALESCE(ROUND(EXTRACT(epoch FROM now() - pg_last_xact_replay_timestamp())),0) AS seconds};
51175122
}
@@ -5141,7 +5146,12 @@ sub check_hot_standby_delay {
51415146
}
51425147

51435148
## On master
5144-
$SQL = q{SELECT pg_current_xlog_location() AS location};
5149+
if ($version >= 10) {
5150+
$SQL = q{SELECT pg_current_wal_lsn() AS location};
5151+
}
5152+
else {
5153+
$SQL = q{SELECT pg_current_xlog_location() AS location};
5154+
}
51455155
$info = run_command($SQL, { dbnumber => $master });
51465156
for $db (@{$info->{db}}) {
51475157
my $location = $db->{slurp}[0]{location};

0 commit comments

Comments
 (0)