Re: Review: support for multiplexing SIGUSR1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: jcasanov(at)systemguards(dot)com(dot)ec, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Review: support for multiplexing SIGUSR1
Date: 2009-07-27 15:09:28
Message-ID: 10851.1248707368@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> On Mon, Jul 27, 2009 at 2:43 AM, Tom Lane<tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> If we want to be able to signal processes that don't have a ProcState
>> entry, it would be better to assign an independent index instead of
>> overloading BackendId like this.

> OK, I'll change the mechanism to assign a ProcSignalSlot to a process,
> independently from ProcState, but similarly to ProcState: a process gets
> a ProcSignalSlot from newly-introduced freelist at startup, and returns it
> to freelist at exit. Since this assignment and return require the lock, I'll
> introduce a new LWLock for them.

I think you're making things more complicated when they should be
getting simpler.

It strikes me that the current API of "pass the BackendId if known or
InvalidBackendId if not" still works for processes without a BackendId,
as long as you can tolerate a bit of extra search overhead for them.
(You could reduce the search overhead by searching the array back to
front.) So a new process index may be overkill.

>> Do we have a clear idea of what the future applications are?

> Yes, I'm planning to use this mechanism for communication between
> a process which can generate the WAL records and a WAL sender process,
> in Synch Rep. Since not only a backend but also some auxiliary processes
> (e.g., bgwriter) can generate the WAL records, processes which don't have
> a ProcState need to receive the multiplexed signal, too.

Huh? Wouldn't the bgwriter be *sending* the signal not receiving it?

> Umm... the patch should cover a notify interrupt which currently uses
> SIGUSR2?

Getting rid of the separate SIGUSR2 handler would definitely be a good
proof of concept that the mechanism works for more than one use.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2009-07-27 15:12:48 Re: [RFC] new digest datatypes, or generic fixed-len hex types?
Previous Message Tom Lane 2009-07-27 14:20:18 Re: [RFC] new digest datatypes, or generic fixed-len hex types?