From: Gilles Darold Date: Sat, 22 Jun 2019 20:45:00 +0000 (+0200) Subject: Add a warning about version and skip loading incompatible binary file. X-Git-Tag: v11.0~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82b5885056cdadeadd616bff34237f28135c7fb6;p=pgbadger Add a warning about version and skip loading incompatible binary file. --- diff --git a/pgbadger b/pgbadger index cdfd277..3740c95 100755 --- a/pgbadger +++ b/pgbadger @@ -12413,6 +12413,11 @@ sub load_stats my $fd = shift; my %stats = %{ fd_retrieve($fd) }; + if (!exists $stats{version}) + { + warn("can not load incompatible binary data, binary file is from version < 4.0.\n"); + return; + } my %_overall_stat = %{$stats{overall_stat}}; my %_pgb_overall_stat = %{$stats{pgb_overall_stat}}; my %_overall_checkpoint = %{$stats{overall_checkpoint}}; @@ -13154,6 +13159,7 @@ sub dump_as_binary my $lfh = shift(); store_fd({ + 'version' => \$VERSION, 'overall_stat' => \%overall_stat, 'pgb_overall_stat' => \%pgb_overall_stat, 'overall_checkpoint' => \%overall_checkpoint,