| From: | Xuneng Zhou <xunengzhou(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Fix safe_wal_size for slots without restart_lsn |
| Date: | 2026-05-28 01:22:07 |
| Message-ID: | CABPTF7WVLrbOydpEMiS0rTdp_ZhEJD=QJ=X1Z5FA6ph8ejmW4A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Thu, May 28, 2026 at 9:01 AM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
>
> On Wed, May 27, 2026 at 6:55 PM Xuneng Zhou <xunengzhou(at)gmail(dot)com> wrote:
> >
> > Hi,
> >
> > Currently, pg_replication_slots can report a non-null safe_wal_size
> > for a replication slot that has never reserved WAL, if
> > max_slot_wal_keep_size is finite.
> >
> > Such a slot has restart_lsn = NULL and wal_status = NULL. safe_wal_size is
> > derived from restart_lsn, so it's not meaningful in this state. The
> > current code handles WALAVAIL_REMOVED but not WALAVAIL_INVALID_LSN
> > before computing safe_wal_size, leading arithmetic on InvalidXLogRecPtr.
> >
> > Fix this by returning NULL for safe_wal_size when WAL availability is
> > WALAVAIL_INVALID_LSN.
> >
>
> Fixed the indentation issue in v1 and updated the comment and doc. Not
> sure this small issue warrants an additional test, still added one in
> case someone wants it.
Improved the readability of the new test.
--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Fix-safe_wal_size-for-slots-without-restart_lsn.patch | application/octet-stream | 4.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomas Vondra | 2026-05-28 01:29:15 | Re: Is there value in having optimizer stats for joins/foreignkeys? |
| Previous Message | Peter Smith | 2026-05-28 01:20:03 | Re: Proposal: Conflict log history table for Logical Replication |