From 4ad24cd903766fc21132bc5ff4a80be5969d492f Mon Sep 17 00:00:00 2001 From: Jehan-Guillaume de Rorthais Date: Wed, 1 Apr 2020 18:12:17 +0200 Subject: [PATCH 2/2] Add test on non archived WAL during crash recovery --- src/test/recovery/t/011_crash_recovery.pl | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/test/recovery/t/011_crash_recovery.pl b/src/test/recovery/t/011_crash_recovery.pl index 526a3481fb..ad512b881f 100644 --- a/src/test/recovery/t/011_crash_recovery.pl +++ b/src/test/recovery/t/011_crash_recovery.pl @@ -15,11 +15,17 @@ if ($Config{osname} eq 'MSWin32') } else { - plan tests => 3; + plan tests => 4; } my $node = get_new_node('master'); -$node->init(allows_streaming => 1); +$node->init( + has_archiving => 1, + allows_streaming => 1); + +$node->append_conf('postgresql.conf', + "archive_command = ''"); + $node->start; my ($stdin, $stdout, $stderr) = ('', '', ''); @@ -43,6 +49,7 @@ $stdin .= q[ BEGIN; CREATE TABLE mine(x integer); SELECT txid_current(); +SELECT pg_switch_wal(); ]; $tx->pump until $stdout =~ /[[:digit:]]+[\r\n]$/; @@ -65,4 +72,9 @@ cmp_ok($node->safe_psql('postgres', 'SELECT txid_current()'), is($node->safe_psql('postgres', qq[SELECT txid_status('$xid');]), 'aborted', 'xid is aborted after crash'); +# make WAL are still waiting to be archived +my $node_data = $node->data_dir; +ok( -f "$node_data/pg_wal/archive_status/000000010000000000000001.ready", + "WAL still waiting to be archived"); + $tx->kill_kill; -- 2.20.1