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


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


#    Failed test 'xid is aborted after crash'
#    at t/011_crash_recovery.pl line 65.
#                got: 'committed'
#        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->safe_psql('postgres'), qq[SELECT pg_xact_status('$xid');]),
             'in progress', 'own xid is 
in-progress');


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


# Crash and restart the postmaster
$node->stop('immediate');
$node->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

Reply via email to