Re: test_fsync file overrun

Lists: pgsql-hackers
From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: test_fsync file overrun
Date: 2009-09-14 03:09:04
Message-ID: f67928030909132009s4f15dae6gbd92670f2ac23d3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

test_fsync in tools/fsync pre-creates a 16MB file. If it is given a number
of iterations greater than 1024 (like one might use if trying to see what
happens when NVRAM gets filled, or on a journaling file system), than one of
the writes being timed will have to extend the size of the pre-created test
file, which can greatly skew the results.

This patch uses lseek to periodically restart at the beginning of the file,
rather than writing past the end of it.

Cheers,

Jeff

Attachment Content-Type Size
test_fsync_v1.patch text/x-diff 3.9 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: test_fsync file overrun
Date: 2009-09-21 20:21:11
Message-ID: 200909212021.n8LKLB504952@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jeff Janes wrote:
> test_fsync in tools/fsync pre-creates a 16MB file. If it is given a number
> of iterations greater than 1024 (like one might use if trying to see what
> happens when NVRAM gets filled, or on a journaling file system), than one of
> the writes being timed will have to extend the size of the pre-created test
> file, which can greatly skew the results.
>
> This patch uses lseek to periodically restart at the beginning of the file,
> rather than writing past the end of it.

Oh, I never noticed that the later tests kept appending to the file
rather then overwriting it. I have applied the attached fix for CVS
HEAD that just uses lseek() before each write group, as you suggested.
I have backpatched it to 8.4.X because the original code created 16GB
files in tests (yikes).

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachment Content-Type Size
/rtmp/diff text/x-diff 3.4 KB