Re: Detach shared memory in Postmaster child if not needed

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Rui Zhao <xiyuan(dot)zr(at)alibaba-inc(dot)com>, hlinnaka <hlinnaka(at)iki(dot)fi>, robertmhaas <robertmhaas(at)gmail(dot)com>, tgl <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Detach shared memory in Postmaster child if not needed
Date: 2024-07-29 11:44:20
Message-ID: CAJ7c6TPU6CLsVgHs1yRtpDH+H79ghh3kHt0GH85EY2ZUjnxZ-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Rui,

> Prior to PG16, postmaster children would manually detach from shared memory
> if it was not needed. However, this behavior was removed in fork mode in
> commit aafc05d.
>
> Detaching shared memory when it is no longer needed is beneficial, as
> postmaster children (like syslogger) don't wish to take any risk of
> accidentally corrupting shared memory. Additionally, any panic in these
> processes will not reset shared memory.
>
> The attached patch addresses this issue by detaching shared memory after
> fork_process().

Thanks for the patch. How do you estimate its performance impact?

Note the comments for postmaster_child_launch(). This function is
exposed to the third-party code and guarantees to attach shared
memory. I doubt that there is much third-party code in existence to
break but you should change to comment.

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2024-07-29 11:55:22 Re: Conflict detection and logging in logical replication
Previous Message Amit Kapila 2024-07-29 11:42:16 Re: Remove duplicate table scan in logical apply worker and code refactoring