[HACKERS] PoC: custom signal handler for extensions - Mailing list pgsql-hackers

From Maksim Milyutin
Subject [HACKERS] PoC: custom signal handler for extensions
Date
Msg-id 3f905f10-cf7a-d4e0-64a1-7fd9b8351592@gmail.com
Whole thread Raw
Responses Re: PoC: custom signal handler for extensions
Re: [HACKERS] PoC: custom signal handler for extensions
Re: [HACKERS] PoC: custom signal handler for extensions
List pgsql-hackers
Hi, hackers!


I want to propose the patch that allows to define custom signals and 
their handlers on extension side. It is based on ProcSignal module, 
namely it defines the fixed set (number is specified by constant) of 
custom signals that could be reserved on postgres initialization stage 
(in _PG_init function of shared preloaded module) through specific 
interface functions. Functions that are custom signal handlers are 
defined in extension. The relationship between custom signals and 
assigned handlers (function addresses) is replicated from postmaster to 
child processes including working backends. Using this signals we are 
able to call specific handler (via SendProcSignal function) on remote 
backend that is actually come into action in CHECK_FOR_INTERRUPTS point.

In perspective, this mechanism provides the low-level instrument to 
define remote procedure call on extension side. The simple RPC that 
defines effective userid on remote backend (remote_effective_user 
function) is attached for example.

C&C welcome!


-- 
Regards,
Maksim Milyutin


Attachment

pgsql-hackers by date:

Previous
From: Sergei Kornilov
Date:
Subject: Re: [HACKERS] Restricting maximum keep segments by repslots
Next
From: Maksim Milyutin
Date:
Subject: Re: Using ProcSignal to get memory context stats from a runningbackend