| From: | "Drouvot, Bertrand" <bdrouvot(at)amazon(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com> |
| Cc: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Patch proposal: New hooks in the connection path |
| Date: | 2022-08-08 10:51:20 |
| Message-ID: | 51b3c711-d8bb-babd-dbd6-bcdad1633bb8@amazon.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 7/12/22 2:58 PM, Drouvot, Bertrand wrote:
> Hi,
>
> On 7/11/22 8:18 AM, Drouvot, Bertrand wrote:
>> Hi,
>>
>> The use case would be to increment a counter in shared memory (or
>> most probably within an hash table) to reflect the number of times a
>> startup packet timeout occurred.
>>
>> Reading the comments in/related to BackendInitialize() I understand
>> that's definitely not safe to write in shared memory for the
>> EXEC_BACKEND case, but wouldn't it be safe for the non EXEC_BACKEND
>> case?
>>
>> BTW, it makes me realize that the hook being fired in the bad startup
>> packet case:
>>
>> /*
>> * Stop here if it was bad or a cancel packet.
>> ProcessStartupPacket
>> * already did any appropriate error reporting.
>> */
>> if (status != STATUS_OK)
>> + {
>> + if (FailedConnection_hook)
>> + (*FailedConnection_hook)
>> (FCET_BAD_STARTUP_PACKET, port);
>> proc_exit(0);
>> + }
>>
>> is not safe for the EXEC_BACKEND case.
>>
> What about the idea to trigger the hook for the STARTUP PACKET TIMEOUT
> and BAD STARTUP PACKET only for the non EXEC_BACKEND/Windows cases?
>
> I'm tempted to think it's better to have some cases where one could
> benefit from the hook as opposed to none.
>
> Thoughts?
Please find attached v2-0004-connection_hooks.patch as an attempt of
doing so.
Thanks
--
Bertrand Drouvot
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v2-0004-connection_hooks.patch | text/plain | 4.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yuya Watari | 2022-08-08 11:27:46 | Re: [PoC] Reducing planning time when tables have many partitions |
| Previous Message | Drouvot, Bertrand | 2022-08-08 10:43:14 | Re: [PATCH] Expose port->authn_id to extensions and triggers |