diff options
Diffstat (limited to 'src/test/recovery/t/029_stats_restart.pl')
-rw-r--r-- | src/test/recovery/t/029_stats_restart.pl | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/test/recovery/t/029_stats_restart.pl b/src/test/recovery/t/029_stats_restart.pl index e0478f8af8d..2fe8db88079 100644 --- a/src/test/recovery/t/029_stats_restart.pl +++ b/src/test/recovery/t/029_stats_restart.pl @@ -113,7 +113,23 @@ overwrite_file($og_stats, "ZZZZZZZZZZZZZ"); $node->start; # no stats present due to invalid stats file -$sect = "invalid"; +$sect = "invalid_overwrite"; +is(have_stats('database', $dboid, 0), 'f', "$sect: db stats do not exist"); +is(have_stats('function', $dboid, $funcoid), + 'f', "$sect: function stats do not exist"); +is(have_stats('relation', $dboid, $tableoid), + 'f', "$sect: relation stats do not exist"); + + +## check invalid stats file starting with valid contents, but followed by +## invalid content is handled. + +trigger_funcrel_stat(); +$node->stop; +append_file($og_stats, "XYZ"); +$node->start; + +$sect = "invalid_append"; is(have_stats('database', $dboid, 0), 'f', "$sect: db stats do not exist"); is(have_stats('function', $dboid, $funcoid), 'f', "$sect: function stats do not exist"); @@ -285,7 +301,17 @@ sub overwrite_file { my ($filename, $str) = @_; open my $fh, ">", $filename - or die "could not write \"$filename\": $!"; + or die "could not overwrite \"$filename\": $!"; + print $fh $str; + close $fh; + return; +} + +sub append_file +{ + my ($filename, $str) = @_; + open my $fh, ">>", $filename + or die "could not append to \"$filename\": $!"; print $fh $str; close $fh; return; |