Use pg_pwrite() in pg_test_fsync

Started by Thomas Munroalmost 6 years ago3 messageshackers
Jump to latest
#1Thomas Munro
thomas.munro@gmail.com

Hi,

Since pg_test_fsync is supposed to simulate some aspects of
PostgreSQL's wal_sync_method settings, I think it should be updated to
use the same system calls (which changed in v12). That's mostly on
principle, though in practice, on one system I've managed to see a
small measurable difference.

I left the fsync-after-closing and non-sync'd tests using write(),
because they weren't using lseek(). The latter case is arguably a bit
odd because it's not overwriting pre-allocated blocks, unlike the
earlier tests.

Attachments:

0001-Use-pg_pwrite-in-pg_test_fsync.patchtext/x-patch; charset=US-ASCII; name=0001-Use-pg_pwrite-in-pg_test_fsync.patchDownload+24-20
#2Thomas Munro
thomas.munro@gmail.com
In reply to: Thomas Munro (#1)
Re: Use pg_pwrite() in pg_test_fsync

On Sun, Jan 10, 2021 at 9:21 AM Thomas Munro <thomas.munro@gmail.com> wrote:

I left the fsync-after-closing and non-sync'd tests using write(),
because they weren't using lseek(). The latter case is arguably a bit
odd because it's not overwriting pre-allocated blocks, unlike the
earlier tests.

On closer inspection, the weird thing about that final test is that
it's opening and closing the file every time. That doesn't seem to
make any sense. Perhaps it's a copy and paste error from the previous
test? In v2 I changed it to pg_pwrite(), and moved the open and close
calls out of the loop.

Attachments:

v2-0001-Use-pg_pwrite-in-pg_test_fsync.patchtext/x-patch; charset=US-ASCII; name=v2-0001-Use-pg_pwrite-in-pg_test_fsync.patchDownload+28-24
#3Thomas Munro
thomas.munro@gmail.com
In reply to: Thomas Munro (#2)
Re: Use pg_pwrite() in pg_test_fsync

On Sun, Jan 24, 2021 at 1:50 PM Thomas Munro <thomas.munro@gmail.com> wrote:

On Sun, Jan 10, 2021 at 9:21 AM Thomas Munro <thomas.munro@gmail.com> wrote:

I left the fsync-after-closing and non-sync'd tests using write(),
because they weren't using lseek(). The latter case is arguably a bit
odd because it's not overwriting pre-allocated blocks, unlike the
earlier tests.

On closer inspection, the weird thing about that final test is that
it's opening and closing the file every time. That doesn't seem to
make any sense. Perhaps it's a copy and paste error from the previous
test? In v2 I changed it to pg_pwrite(), and moved the open and close
calls out of the loop.

Pushed.