| From: | Xuneng Zhou <xunengzhou(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Fix safe_wal_size for slots without restart_lsn |
| Date: | 2026-05-27 10:55:18 |
| Message-ID: | CABPTF7VkJEJa4Ze2q2jNUp3k-0AbpwvW0cGHrsEQiezU0h6Z+Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
--
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-safe_wal_size-for-slots-without-restart_lsn.patch | application/octet-stream | 1.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-05-27 10:59:59 | Re: [PATCH] Release replication slot on error in SQL-callable slot functions |
| Previous Message | Daniel Gustafsson | 2026-05-27 10:47:32 | Re: PostgreSQL and OpenSSL 4.0.0 |