Disable WAL backup pages when fsync is off

Started by Bruce Momjianabout 21 years ago4 messagespatches
Jump to latest
#1Bruce Momjian
bruce@momjian.us

The following patch disables WAL backup pages when fsync is off.

-- 
  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, Pennsylvania 19073

Attachments:

/pgpatches/fsynctext/plainDownload+4-4
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: Disable WAL backup pages when fsync is off

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The following patch disables WAL backup pages when fsync is off.

This is a good idea why?

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Disable WAL backup pages when fsync is off

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The following patch disables WAL backup pages when fsync is off.

This is a good idea why?

There is no need to write backup pages if fsync is off. Our TODO has:

* Turn off after-change writes if fsync is disabled

If fsync is off, there is no purpose in writing full pages to WAL

Basically, with fsync off, you are saying you don't care about crash
recovery, so why write those pages?

-- 
  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, Pennsylvania 19073
#4Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#3)
Re: Disable WAL backup pages when fsync is off

Russell Smith wrote:

On Sun, 3 Jul 2005 03:51 pm, Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

The following patch disables WAL backup pages when fsync is off.

This is a good idea why?

If it is, why do we write wal at all if fsync is off?

Good question. WAL is to recover the file system files in case of a
crash. WAL is used in cases where PostgreSQL crashes, but the operating
system is still running. WAL brings the file system files back to a
consistent state containing all completed transactions.

fsync() is for forcing the data to disk so an operating system crash is
recoverable. If that isn't happening, the cleanup of partial page
writes is hardly important because the system is not consistent.

-- 
  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, Pennsylvania 19073