[HACKERS] PoC: custom signal handler for extensions

From: Maksim Milyutin <milyutinma(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: [HACKERS] PoC: custom signal handler for extensions
Date: 2017-12-22 12:05:25
Message-ID: 3f905f10-cf7a-d4e0-64a1-7fd9b8351592@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
custom_signals.patch text/plain 7.4 KB
remote_effective_user.c text/plain 3.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Maksim Milyutin 2017-12-22 12:50:22 Re: Using ProcSignal to get memory context stats from a running backend
Previous Message Sergei Kornilov 2017-12-22 12:04:20 Re: [HACKERS] Restricting maximum keep segments by repslots