From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: logical replication of truncate command with trigger causes Assert |
Date: | 2021-06-08 22:55:46 |
Message-ID: | 1250962.1623192946@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com> writes:
> On master, when a statement level trigger is fired for a replicated truncate command, the following stack trace is generated:
Hmm.
> I believe the issue was introduced in commit 84f5c2908da which added EnsurePortalSnapshotExists. That's not going to work in the case of logical replication, because there isn't an ActivePortal nor a snapshot.
The right way to say that is "commit 84f5c2908da exposed the pre-existing
unsafe behavior of this code". It's not okay to run arbitrary user code
without holding a snapshot to protect TOAST dereference operations.
I suppose that either apply_dispatch or LogicalRepApplyLoop needs to
grow some more snapshot management logic, but I've not looked at that
code much, so I don't have an opinion on just where to add it.
There's a reasonable case to be made that running user code outside
a Portal is a just-plain-bad idea, so we should fix the logical
apply worker to make it create a suitable Portal. I speculated about
that in the commit message for 84f5c2908da, but I don't feel like
taking point on such work.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2021-06-08 22:56:18 | Re: array_cat anycompatible change is breaking xversion upgrade tests (v14 release notes) |
Previous Message | Peter Geoghegan | 2021-06-08 22:52:02 | Re: pg14b1 stuck in lazy_scan_prune/heap_page_prune of pg_statistic |