Re: Allowing WAL fsync to be done via O_SYNC - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allowing WAL fsync to be done via O_SYNC
Date
Msg-id 16027.984697876@sss.pgh.pa.us
Whole thread Raw
In response to Re: Allowing WAL fsync to be done via O_SYNC  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> switch(lower(string[0]) + lower(string[5]))
> {
>     case 'f':    /* fsync */
>     case 'f' + 's':    /* fdatasync */
>     case 'o' + 's':    /* open_sync */
>     case 'o' + 'd':    /* open_datasync */
> }

> Although ugly, it should serve as a readable solution for now.

Ugly is the word ...

>> Do you object if I add an "assign_hook" to guc.c that's called when an
>> actual assignment is made?

> Something like this is on my wish list, but I'm not sure if it's wise to
> start this now.

I'm not particularly concerned about changing the interface later if
that proves necessary.  We're not likely to have so many of the things
that an API change is burdensome, and they will all be strictly backend
internal.

What I have in mind for now is just
void (*assign_hook) (const char *newval);

(obviously this is for string variables only, for now) called just
before actually changing the variable value.  This lets the hook see
the old value if it needs to.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Allowing WAL fsync to be done via O_SYNC
Next
From: Alfred Perlstein
Date:
Subject: Re: Allowing WAL fsync to be done via O_SYNC