On Mon, 17 Aug 2026 at 23:53, Hayato Kuroda (Fujitsu)
<[email protected]> wrote:
> While working on the parallel apply, I found that 013_partition.pl raises 
> WARNINGs
> like [1]. Per my research it happened after the 39dcfda. The warning 
> indicates the
> partition leaf opened by the worker is not expressly closed.

> I'm not familiar with codes around triggers. But if we try to fix on logical
> replication side, relations opened for triggers can be closed in 
> finish_edata().
> See attached.

Thanks for the report and patch. I had a look and confirm that the
warnings appear without the patch and are gone with the patch.
However, I don't think it's a good idea to code the loop over
estate->es_trig_target_relations the way you have it. Accessing
EState's es_trig_target_relations field from worker.c to close open
resources feels wrong.

I modified your patch and added a new external function named
ExecCloseTrigTargetRelations() and modified finish_edata() to call
that instead. I also adjusted the 013_partition.pl test to grep the
logs to ensure no more resource leaks. I did wonder if something like
that should appear somewhere more generic so it applies to more tests,
but I didn't study the TAP test harness enough to understand where
that might go.

The leak message did change in b8bff07da, so I've attached two
patches, v16 for 15-16 and v20 for 17-master.

David

Attachment: v16-0001-Close-relations-opened-specifically-for-AFTER-tr.patch
Description: Binary data

Attachment: v20-0001-Close-relations-opened-specifically-for-AFTER-tr.patch
Description: Binary data

Reply via email to