Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review]) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])
Date
Msg-id 23561.1375721604@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])  (Bruce Momjian <bruce@momjian.us>)
Re: Re: ALTER SYSTEM SET command to change postgresql.conf parameters (RE: Proposal for Allow postgresql.conf values to be changed via SQL [review])  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-08-05 12:18:25 -0400, Bruce Momjian wrote:
>> I am unclear why we don't need a lock around _each_ GUC, i.e. if two
>> sessions try to modify the same GUC at the same time.  And if we need a
>> lock, seems we can have just one and write all the settings to one file
>> --- it is not like we have trouble doing locking, though this is
>> cluster-wide locking.

> If you have two sessions modifying the same variable, one is going to
> win and overwrite the other's setting with or without locking around
> GUCs unless you error out if somebody else holds the lock.

The point of a lock is just to ensure that the end result is one valid
state or the other, and not something corrupt.  We would certainly need a
lock if we write to a single file.  With file-per-GUC, we could possibly
dispense with a lock if we depend on atomic file rename(); though whether
it's wise to assume that for Windows is unclear.  (Note that we ought to
write a temp file and rename it into place anyway, to avoid possibly
corrupting the existing file on out-of-disk-space.  The only thing that
needs discussion is whether to add an explicit lock around that.)
        regards, tom lane



pgsql-hackers by date:

Previous
From: Atri Sharma
Date:
Subject: Re: StrategyGetBuffer optimization, take 2
Next
From: Josh Berkus
Date:
Subject: Re: Unsafe GUCs and ALTER SYSTEM WAS: Re: ALTER SYSTEM SET