Hi, On Monday, August 24, 2026 1:48 PM David Rowley <[email protected]> wrote: > 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.
The fix looks good to me. I just noticed one nit in the test: + ok(!$node->log_contains(qr/resource was not closed/), + 'unclosed resources on ' . $node->name); I think the test message should be: "no unclosed resources on". Best Regards, Zhijie Hou
