Re: sync() - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: sync()
Date
Msg-id 200301080618.h086IZU29394@candle.pha.pa.us
Whole thread Raw
In response to sync()  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: sync()  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: sync()  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
Tatsuo Ishii wrote:
> I noticed sync() is used in PostgreSQL.
> 
> CHECKPOINT -> FlushBufferPool() -> smgrsync() -> mdsync() -> sync()
> 
> Can someone tell me why we need sync() here?

As part of checkpoint, we discard some WAL files.  To do that, we must
first be sure that all the dirty buffers we have written to the kernel
are actually on the disk.  That is why the sync() is required.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: sync()
Next
From: Tom Lane
Date:
Subject: Re: sync()