| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Vitaly Davydov' <v(dot)davydov(at)postgrespro(dot)ru> |
| Cc: | suyu(dot)cmj <mengjuan(dot)cmj(at)alibaba-inc(dot)com>, aekorotkov <aekorotkov(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, tomas <tomas(at)vondra(dot)me>, michael <michael(at)paquier(dot)xyz>, bharath(dot)rupireddyforpostgres <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | RE: Newly created replication slot may be invalidated by checkpoint |
| Date: | 2025-10-31 09:48:10 |
| Message-ID: | OS7PR01MB14968585820C4C31575BFA5FDF5F8A@OS7PR01MB14968.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Dear Vitaly,
Thanks for sharing the reproducer. Agreed this is a real but minor issue.
Firstly I considered an ad-hoc way, which sets the candidate restart_lsn as
replicationSlotMinLSN before using as slot->data.restart_lsn. PSA the idea.
It can fix your reproducer.
However it still has a corner case; Assuming the checkpointer finishes computing
removal WALs before setting the restart_lsn to system_wide one, and checkpointer
tries to invalidate slots after restart_lsn of the slot is set.
In this case the checkpointer detects the creating slot and its restart_lsn is
older than oldest one. The checkpointer terminates the backend and
invalidates the slot.
This can be reproduced by moving 1) checkpoint-before-old-wal-removal to
in-between KeepLogSeg() and InvalidateObsoleteReplicationSlots(), and
2) physical-slot-reserve-wal-get-redo before the XLogMaybeSetReplicationSlotMinimumLSN().
For now, I cannot come up with the good fix. How about others?
BTW, can you update meson.build as well when you add .pl test code? Otherwise, it
cannot be run for meson builders.
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| Attachment | Content-Type | Size |
|---|---|---|
| idea.diffs | application/octet-stream | 1.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Shardul Borhade | 2025-10-31 09:50:02 | Re: Question on pg_stat_io showing zero reads/writes for I/O workers |
| Previous Message | Xuneng Zhou | 2025-10-31 09:43:46 | Re: Question on pg_stat_io showing zero reads/writes for I/O workers |