On 5/6/26 13:31, Alexander Korotkov wrote:
I'd like to propose another approach. It actually appears that the
only thing we actually need from ControlFileData before we get shmem
attached is data_checksum_version. Attached patch passes just
data_checksum_version via BackendParameters. So, there is no local
pg_control copy, and no risk to accidentally use it.
Alexander, good day!
I found CF link [1] to this patch, let me please share some thoughts too.
It seems it can be difficult to support it, later can appear some new fields
that should be attached to BackendParameters. For example now it seems
new fields
data_checksum_lsn and data_checksum_is_local should be attached too,
please take a
look at sha b52a1c2c8a6. Maybe your patch should be rebased.
So it seems we have difficult choice: from one side we can use full
copy, but there is
risk using stale vals, from other side we can forget to extend
BackendParameters attrs list.
For me it seems that main problem that we can't read control file with
LWLock ControlFileLock.
Maybe we should reorder LWLock initialization and put it before reading
control file. I am not
sure that it is possible, but it looks like interesting approach with
great benefit, because we
avoid possibility of stale values, don't need extension of
BackendParameters and align behavior with
forked processes.
Anyway, current patch looks like implementation of one of approaches and
in my opinion it can be applied,
but it seems it should be rebased.
Best regards,
Maksim Melnikov
Links
[1] https://commitfest.postgresql.org/patch/5124/