Re: sync()

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tatsuo Ishii <t-ishii@sra.co.jp>
Cc: pgman@candle.pha.pa.us, pgsql-hackers@postgresql.org
Date: 2003-01-08T06:42:42Z
Lists: pgsql-hackers
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> Can someone tell me why we need sync() here?

> ?? I thought WAL files are synced by pg_fsync() (if needed).

They are.  But to write a checkpoint record --- which implies that the
WAL records before it need no longer be replayed --- we have to ensure
that all the changes-so-far in the regular database files are written
down to disk.  That is what we need sync() for.

			regards, tom lane