Re: Reducing power consumption on idle servers - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Reducing power consumption on idle servers
Date
Msg-id 2222369.1645897449@sss.pgh.pa.us
Whole thread Raw
In response to Re: Reducing power consumption on idle servers  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Reducing power consumption on idle servers  (Simon Riggs <simon.riggs@enterprisedb.com>)
List pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
>> Deprecating explicit file-based promotion is possible and simple, so
>> that is the approach in the latest version of the patch.

> Is there any actual use-case for this other than backwards
> compatibility?

The fundamental problem with signal-based promotion is that it's
an edge-triggered rather than level-triggered condition, ie if you
miss the single notification event you're screwed.  I'm not sure
why we'd want to go there, considering all the problems we're having
with edge-triggered APIs in nearby threads.

We could combine the two approaches, perhaps: have "pg_ctl promote"
create a trigger file and then send a signal.  The trigger file
would record the existence of the promotion request, so that if the
postmaster isn't running right now or misses the signal, it'd still
promote when restarted or otherwise at the next opportunity.
But with an approach like this, we could expect quick response to
the signal in normal conditions, without need for constant wakeups
to check for the file.  Also, this route would allow overloading
of the signal, since it would just mean "wake up, I asked you to
do something" rather than needing to carry the full semantics of
what is to be done.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Reducing power consumption on idle servers
Next
From: Tom Lane
Date:
Subject: Missed condition-variable wakeups on FreeBSD