| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com> |
| Cc: | Rahul <rahul(at)rhyadav(dot)dev>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Nktpro <nktpro(at)gmail(dot)com>, Pgsql Bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: PostgreSQL 18.6/17.11: standby PANIC on restart after VM truncation |
| Date: | 2026-11-16 16:03:25 |
| Message-ID: | CAAKRu_bnmOWQiQN93qS1oEEVw8X09Y-sGhs56avw8y7ysffw1w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
On Tue, Oct 13, 2026 at 11:20 PM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> > Jacky's original fix with XLogTruncateRelation() is the one I prefer.
>
> Fine with me. I tested v5 on master, 19, 18 and 17. With the fix the
> standby restarts.
While working on committing this, an AI review pointed out that the
HEAPBLK_TO_MAPBLOCK_LIMIT() macro is not overflow safe and needs to be
fixed. This patch adds a user of visibilitymap_truncation_length(),
but the existing user, wal summarizer can already encounter this bug.
A heap block number near MaxBlockNumber can be passed it and then
adding HEAPBLOCKS_PER_PAGE - 1 overflows it and wraps it to a small
number, recording a VM limit much smaller than is correct and causing
the summarizer to discard tracked VM modifications for the rest of the
fork.
I think the attached preliminary patch 0001 has to be committed before 0002.
We don't have a good way of adding a regression test for this that
doesn't take forever because of the large heap block number required.
> One small thing. On 17 the test part does not apply, because
> 001_concurrent_transaction.pl has no standby there.
Thanks for the heads up. I've implemented the 17 port locally.
- Melanie
| Attachment | Content-Type | Size |
|---|---|---|
| v6-0001-Avoid-overflow-computing-visibility-map-length.patch | text/x-patch | 1.5 KB |
| v6-0002-Forget-invalid-VM-pages-during-truncation-replay.patch | text/x-patch | 4.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Matheus Alcantara | 2026-11-16 16:07:34 | Re: BUG #19772: ERROR: corrupt MVNDistinct entry for GROUP BY c0, ROLLUP (abs(c0)) with ndistinct statistics |
| Previous Message | Dilip Kumar | 2026-11-16 15:46:23 | Re: BUG #19892: Logical replication skips UPDATE/DELETE of rows with NULL in a hash-indexed subscriber column |