| From: | "Maksim(dot)Melnikov" <m(dot)melnikov(at)postgrespro(dot)ru> |
|---|---|
| To: | Alexander Korotkov <aekorotkov(at)gmail(dot)com> |
| Cc: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund<andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Nathan Bossart <nathandbossart(at)gmail(dot)com>,Melanie Plageman <melanieplageman(at)gmail(dot)com>,Michael Paquier <michael(at)paquier(dot)xyz>,Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>,"pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
| Subject: | Re: race condition when writing pg_control |
| Date: | 2026-11-17 10:52:30 |
| Message-ID: | 27ab05bc-e1cc-4f1f-b93a-969d57ed6f9e@postgrespro.ru |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | vignesh C | 2026-11-17 11:20:51 | Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE) |
| Previous Message | Hayato Kuroda (Fujitsu) | 2026-11-17 10:17:08 | RE: Test publication.sql racing with subscription.sql might fail due to cache lookup error |