On Mon, Jul 12, 2021 at 9:31 AM Euler Taveira <eu...@eulerto.com> wrote: > > cfbot seems to be unhappy with v18 on some of the hosts. Cirrus/FreeBSD failed > in the test 010_truncate. It also failed in a Cirrus/Linux box. I failed to > reproduce in my local FreeBSD box. Since it passes appveyor and Cirrus/macos, > it could probably be a transient issue. >
I don't think it's a transient issue. I also get a test failure in subscription/010_truncate.pl when I run "make check-world" with the v18 patches applied. The problem can be avoided with the following change (to match what was originally in my v17-0005 performance-improvement patch): diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 08c018a300..800bae400b 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1256,8 +1256,8 @@ get_rel_sync_entry(PGOutputData *data, Relation relation) } /* create a tuple table slot for row filter */ - tupdesc = RelationGetDescr(relation); oldctx = MemoryContextSwitchTo(CacheMemoryContext); + tupdesc = CreateTupleDescCopy(RelationGetDescr(relation)); entry->scantuple = MakeSingleTupleTableSlot(tupdesc, &TTSOpsHeapTuple); MemoryContextSwitchTo(oldctx); This creates a TupleDesc copy in CacheMemoryContext that is not refcounted, so it side-steps the problem. At this stage I am not sure why the original v18 patch code doesn't work correctly for the TupleDesc refcounting here. The TupleDesc refcount is zero when it's time to dealloc the tuple slot (thus causing that Assert to fire), yet when the slot was created, the TupleDesc refcount was incremented.- so it seems something else has already decremented the refcount by the time it comes to deallocate the slot. Perhaps there's an order-of-cleanup or MemoryContext issue here or some buggy code somewhere, not sure yet. Regards, Greg Nancarrow Fujitsu Australia