Re: Simplifying wal_sync_method - Mailing list pgsql-hackers

From Magnus Hagander
Subject Re: Simplifying wal_sync_method
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE6C784C@algol.sollentuna.se
Whole thread Raw
In response to Simplifying wal_sync_method  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: Simplifying wal_sync_method  (Marko Kreen <marko@l-t.ee>)
List pgsql-hackers
> > > > Currently, here are the options available for wal_sync_method:
> > > >
> > > >     #wal_sync_method = fsync        # the default
> varies across platforms:
> > > >                                     # fsync,
> fdatasync, fsync_writethrough,
> > > >                                     # open_sync,
> open_datasync
> > >
> > > On same topic:
> > >
> > >
> http://archives.postgresql.org/pgsql-general/2005-07/msg00811.php
> > >
> > > Why does win32 PostgreSQL allow data corruption by default?
> >
> > It behaves the same on Unix as Win32, and if you have
> battery-backed
> > cache, you don't need writethrough, so we don't have it as
> default.  I

Correction, if you have bbwc, you *should not* have writethrough. Not
only do you not need it, enabling it will drastically lower performance.


> > am going to write a section in the manual for 8.1 about these
> > reliability issues.
>
> For some reason I don't see "corruped database after crash"
> reports on Unixen.  Why?

Because you don't read the lists often enough? I see it happen quite
often.


> Also, why can't win32 be safe without battery-backed cache?
> I can't see such requirement on other platforms.

It can, you just need to learn how to configure your system. There are
two different options to make it safe on win32 without battery backed
cache:

1) Use the postgresql option for fsync write through

2) Configure windows to disable write caching. If you do this, which you
of course already do on all your windows servers without write cache I
hope since it affects all windows operations including the filesystem
itself, you are safe with the default settings in postgresql.



I think what a lot of people don't realise is how easy option 2 is. It's
in traditional windows style *a single checkbox* in the harddisk
configuration.
(Granted, you need a modern windows for that. On older windows it's a
registry key)


I have some code floating in my tree to issue a WARNING on startup if
write cache is enabled and postgresql is not using writethrough. It's
not quite ready yet, but if such a thing would be accepted post
feature-freeze I can have it finished in good time before 8.1. It would
be quite simple (looking at just the main data directory for example,
ignoring tablespaces), but if you're dealing with complex installations
you'd better have a clue about how windows works anyway...


//Magnus


pgsql-hackers by date:

Previous
From: Marko Kreen
Date:
Subject: Re: Simplifying wal_sync_method
Next
From: "Magnus Hagander"
Date:
Subject: Re: Simplifying wal_sync_method