Skip to content

Commit

Permalink
Return WARNING instead of CRITICAL in case of missing archived WAL pr…
Browse files Browse the repository at this point in the history
…ior to latest backup
  • Loading branch information
pgstef committed Nov 14, 2019
1 parent d5acc09 commit 2310866
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog

2019-xx-xx v1.6:

- Return WARNING instead of CRITICAL in case of missing archived WAL prior
to latest backup, regardless its type.
- Add ignore-archived-before argument to ignore the archived WALs before the
provided interval.
- Rename ignore-archived-since argument to ignore-archived-after.
Expand Down
12 changes: 11 additions & 1 deletion check_pgbackrest
Original file line number Diff line number Diff line change
Expand Up @@ -851,10 +851,20 @@ sub check_wal_archives {
$seg_per_wal-- if $dbver <= 92;
my @needed_wal_archives_list=&generate_needed_wal_archives_list($min_wal, $max_wal, \@branch_wals, $seg_per_wal);

# Get the latest backup info
my $latest_bck = @{$backups_info->{'backup'}}[-1];
my $latest_bck_archive_start = $latest_bck->{'archive'}->{'start'};
push @human_only_longmsg, "latest_bck_archive_start=".$latest_bck_archive_start;
push @human_only_longmsg, "latest_bck_type=".$latest_bck->{'type'};

# Go through needed wal list and check if it exists in the file list
foreach my $needed_wal (@needed_wal_archives_list) {
unless (grep /$needed_wal/, @filelist_simplified) {
push @crit_msg => "wrong sequence or missing file @ '$needed_wal'";
if($needed_wal lt $latest_bck_archive_start) {
push @warn_msg => "wrong sequence or missing file @ '$needed_wal'";
}else{
push @crit_msg => "wrong sequence or missing file @ '$needed_wal'";
}
}
}

Expand Down

0 comments on commit 2310866

Please sign in to comment.