Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #359 (Last Vacuum Always Errors on Hot Standby Cluster) #360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 20 additions & 1 deletion check_pgactivity
Original file line number Diff line number Diff line change
Expand Up @@ -5182,7 +5182,26 @@ Required privileges: unprivileged role able to log in all databases.
=cut

sub check_last_vacuum {
return check_last_maintenance( 'vacuum', @_ );
my @rs;
my @hosts;
my %args = %{ $_[0] };
my $me = 'POSTGRES_CHECK_LAST_VACUUM';
my %queries = (
$PG_VERSION_90 => q{SELECT pg_is_in_recovery()}
);

@hosts = @{ parse_hosts %args };

pod2usage(
-message => 'FATAL: you must give only one host with service "check_last_vacuum".',
-exitval => 127
) if @hosts != 1;

is_compat $hosts[0], 'is_hot_standby', $PG_VERSION_90 or exit 1;
@rs = @{ query_ver( $hosts[0], %queries )->[0] };

return check_last_maintenance( 'vacuum', @_ ) if $rs[0] eq "f";
return status_ok( $me, [ "Cluster is hot standby, skipping check" ] );
}


Expand Down