Thread

  1. Re: Simplifying wal_sync_method

    Bruce Momjian <pgman@candle.pha.pa.us> — 2005-08-08T22:02:37Z

    Alvaro Herrera wrote:
    > On Mon, Aug 08, 2005 at 05:38:59PM -0400, Bruce Momjian wrote:
    > > Marko Kreen wrote:
    > > > On Mon, Aug 08, 2005 at 03:56:39PM -0400, Bruce Momjian wrote:
    > > > > 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
    > > am going to write a section in the manual for 8.1 about these
    > > reliability issues.
    > 
    > I think we should offer the reliable option by default, and mention the
    > fast option for those who have battery-backed cache in the manual.
    
    But only on Win32?
    
    -- 
      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
    
    
  2. Re: Simplifying wal_sync_method

    Alvaro Herrera <alvherre@alvh.no-ip.org> — 2005-08-08T22:14:32Z

    On Mon, Aug 08, 2005 at 06:02:37PM -0400, Bruce Momjian wrote:
    > Alvaro Herrera wrote:
    > > On Mon, Aug 08, 2005 at 05:38:59PM -0400, Bruce Momjian wrote:
    > > > Marko Kreen wrote:
    > > > > On Mon, Aug 08, 2005 at 03:56:39PM -0400, Bruce Momjian wrote:
    > > > > > 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
    > > > am going to write a section in the manual for 8.1 about these
    > > > reliability issues.
    > > 
    > > I think we should offer the reliable option by default, and mention the
    > > fast option for those who have battery-backed cache in the manual.
    > 
    > But only on Win32?
    
    Yes, because that's the only place where that option works, right?
    
    -- 
    Alvaro Herrera (<alvherre[a]alvh.no-ip.org>)
    "I dream about dreams about dreams", sang the nightingale
    under the pale moon (Sandman)
    
    
  3. Re: Simplifying wal_sync_method

    Joshua D. Drake <jd@commandprompt.com> — 2005-08-08T22:22:14Z

    >>>I think we should offer the reliable option by default, and mention the
    >>>fast option for those who have battery-backed cache in the manual.
    >>
    >>But only on Win32?
    > 
    > 
    > Yes, because that's the only place where that option works, right?
    
    fsync_writethrough only works on Win32 the postgresql.conf should 
    reflect that.
    
    > 
    
    
    
  4. Re: Simplifying wal_sync_method

    Marko Kreen <marko@l-t.ee> — 2005-08-08T22:25:31Z

    On Mon, Aug 08, 2005 at 06:02:37PM -0400, Bruce Momjian wrote:
    > Alvaro Herrera wrote:
    > > I think we should offer the reliable option by default, and mention the
    > > fast option for those who have battery-backed cache in the manual.
    > 
    > But only on Win32?
    
    We should do what's possible with what's given to us.
    
    On Win32:
    
    1.  We can write through cache.
    2.  We have unreliable OS with unreliable filesystem.
    3.  The probability of mediocre hardware is higher.
    
    Regular POSIX:
    1.  We can't write through cache.
    2.  We have good OS with good filesystem (probably even
        journaled).
    3.  The probably of mediocre hardware is lower.
    
    Why shouldn't we offer reliable option to win32?
    
    Options:
    
    -  Win32 guy complains that PG is bit slow.
       We tell him to RTFM.
    -  Win32 guy complains he lost database.
       We tell him he didn't RTFM.
    
    Which way you make more friends?
    
    -- 
    marko
    
    PS.  Yeah, I was the guy who helped him to restore what's left.
    I'd say he wasn't exactly happy.
    
    
    
  5. Re: Simplifying wal_sync_method

    Bruce Momjian <pgman@candle.pha.pa.us> — 2005-08-09T03:07:53Z

    Joshua D. Drake wrote:
    > 
    > >>>I think we should offer the reliable option by default, and mention the
    > >>>fast option for those who have battery-backed cache in the manual.
    > >>
    > >>But only on Win32?
    > > 
    > > 
    > > Yes, because that's the only place where that option works, right?
    > 
    > fsync_writethrough only works on Win32 the postgresql.conf should 
    > reflect that.
    
    Right now what wal_sync_method supports isn't clear at all.  If you have
    fdatasync or O_DSYNC (and it has a different value from O_SYNC/O_FSYNC),
    you have those, if not, you get an error.  For example, my system
    doesn't have fdatasync(), so if I try to use that value I get this in my
    server logs:
    
    	FATAL:  invalid value for parameter "wal_sync_method": "fdatasync"
    
    and the server does not start.  Also, writethrough is supported in 8.1
    by both Win32 and OS X.
    
    -- 
      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
    
    
  6. Re: Simplifying wal_sync_method

    Tom Lane <tgl@sss.pgh.pa.us> — 2005-08-09T03:55:03Z

    Bruce Momjian <pgman@candle.pha.pa.us> writes:
    >> fsync_writethrough only works on Win32 the postgresql.conf should 
    >> reflect that.
    
    > Right now what wal_sync_method supports isn't clear at all.
    
    Yeah.  I think we had a TODO to figure out a way for the assign_hook to
    report back exactly which values *are* allowed on the current platform.
    Constructing the message for this doesn't seem very difficult, but the
    rules about when assign_hooks can issue their own elog message seem
    to constrain the usefulness...
    
    			regards, tom lane