Skip to content

Commit 6d69b98

Browse files
committed
Fix check_archive_ready for version 10 and above
The archive_ready check uses the wal_files check with dedicated options - however, since wal_files was fixed for version 10 in 8e6b3c2 it called pg_ls_waldir() even for the archive_ready check which is not appropriate as this only lists files in pg_wal and not in pg_wal/archive_status. This change makes the wal_files check call pg_ls_archive_statusdir() instead if $extrabit (i.e. .ready) is set, fixing issue #150.
1 parent 89249c3 commit 6d69b98

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

check_postgres.pl

+11-2
Original file line numberDiff line numberDiff line change
@@ -9423,8 +9423,17 @@ sub check_wal_files {
94239423

94249424
## Figure out where the pg_xlog directory is
94259425
$SQL = qq{SELECT count(*) AS count FROM $lsfunc($lsargs) WHERE $lsfunc ~ E'^[0-9A-F]{24}$extrabit\$'}; ## no critic (RequireInterpolationOfMetachars)
9426-
my $SQL10 = $opt{lsfunc} ? $SQL :
9427-
qq{SELECT count(*) AS count FROM pg_ls_waldir() WHERE name ~ E'^[0-9A-F]{24}$extrabit\$'}; ## no critic (RequireInterpolationOfMetachars)
9426+
my $SQL10 = "";
9427+
9428+
if ($extrabit) {
9429+
# check_archive_ready
9430+
$SQL10 = $opt{lsfunc} ? $SQL :
9431+
qq{SELECT count(*) AS count FROM pg_ls_archive_statusdir() WHERE name ~ E'^[0-9A-F]{24}$extrabit\$'}; ## no critic (RequireInterpolationOfMetachars)
9432+
} else {
9433+
# check_wal_files
9434+
$SQL10 = $opt{lsfunc} ? $SQL :
9435+
qq{SELECT count(*) AS count FROM pg_ls_waldir() WHERE name ~ E'^[0-9A-F]{24}\$'}; ## no critic (RequireInterpolationOfMetachars)
9436+
}
94289437

94299438
my $info = run_command($SQL, {regex => qr[\d], version => [">9.6 $SQL10"] });
94309439

0 commit comments

Comments
 (0)