Re: Buffer Management - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Buffer Management
Date
Msg-id 7703.1025016772@sss.pgh.pa.us
Whole thread Raw
In response to Re: Buffer Management  ("Mario Weilguni" <mario.weilguni@icomedias.com>)
Responses Re: Buffer Management  (Bradley McLean <brad@bradm.net>)
List pgsql-hackers
"Mario Weilguni" <mario.weilguni@icomedias.com> writes:
> Isn't that what msync() is for? Or is this not portable?

msync can force not-yet-written changes down to disk.  It does not
prevent the OS from choosing to write changes *before* you invoke msync.
For example, the HPUX man page for msync says:
    Normal system activity can cause pages to be written to disk.    Therefore, there are no guarantees that msync() is
theonly control    over when pages are or are not written to disk.
 

Our problem is that we want to enforce the write ordering "WAL before
data file".  To do that, we write and fsync (or DSYNC, or something)
a WAL entry before we issue the write() against the data file.  We
don't really care if the kernel delays the data file write beyond that
point, but we can be certain that the data file write did not occur
too early.

msync is designed to ensure exactly the opposite constraint: it can
guarantee that no changes remain unwritten after time T, but it can't
guarantee that changes aren't written before time T.
        regards, tom lane




pgsql-hackers by date:

Previous
From: "Mario Weilguni"
Date:
Subject: Re: Buffer Management
Next
From: Bruce Momjian
Date:
Subject: Re: Buffer Management