011_crash_recovery.pl failes using wal_block_size=16K

From: walker <failaway(at)qq(dot)com>
To: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: 011_crash_recovery.pl failes using wal_block_size=16K
Date: 2021-03-04 14:34:38
Message-ID: tencent_C92FB8754C4970FE0B3FC3A71CC56540370A@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, hackers

cd source_dir
./configure --enable-tap-tests --with-wal-blocksize=16
make world
make install-world
cd source_dir/src/test/recovery
make check PROVE_TESTS='t/011_crash_recovery.pl' PROVE_FLAGS='--verbose'

the output of the last command is:
011_crash_recovery.pl ..
1..3
ok 1 - own xid is in-progress
not ok 2 - new xid after restart is greater

# &nbsp; &nbsp;Failed test 'new xid after restart is greater'
# &nbsp; &nbsp;at t/011_crash_recovery.pl line 61
# &nbsp; &nbsp; &nbsp; '485'
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt;
# &nbsp; &nbsp; &nbsp; '485'
not ok 3 - xid is aborted after crash

# &nbsp; &nbsp;Failed test 'xid is aborted after crash'
# &nbsp; &nbsp;at t/011_crash_recovery.pl line 65.
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;got: 'committed'
# &nbsp; &nbsp; &nbsp; &nbsp;expected: 'aborted'
# Looks like you failed 2 tests of 3.
Dubious test returned 2(stat 512, 0x200)
Failed 2/3 subtests
......

But if I modified something in t/011_crash_recovery.pl, this perl script works fine, as follows:
is($node-&gt;safe_psql('postgres'), qq[SELECT pg_xact_status('$xid');]),
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'in progress', 'own xid is in-progress');

sleep(1); &nbsp;# here new added,&nbsp;just make sure the CREATE TABLE XLOG can be flushed into WAL segment file on disk.

# Crash and restart the postmaster
$node-&gt;stop('immediate');
$node-&gt;start;

I think the problem is that before crash(simulated by stop with immediate mode), the XLOG of "create table mine" didn't get flushed into wal file on disk. Instead, if delay some time, e.g. 200ms, or more after issue create table, in theory, the data in wal buffer should be written to disk by wal writer.

However, I'm not sure the root cause. what's the difference between wal_blocksize=8k and wal_blocksize=16k while flushing wal buffer data to disk?

thanks
walker

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2021-03-04 14:37:50 Re: Force lookahead in COPY FROM parsing
Previous Message Amit Kapila 2021-03-04 14:33:25 Re: Track replica origin progress for Rollback Prepared