Re: Switching timeline over streaming replication

Heikki Linnakangas <hlinnakangas@vmware.com>

From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Amit Kapila <amit.kapila@huawei.com>, 'PostgreSQL-development' <pgsql-hackers@postgresql.org>
Date: 2012-11-15T15:16:20Z
Lists: pgsql-hackers
On 15.11.2012 16:55, Tom Lane wrote:
> Heikki Linnakangas<hlinnakangas@vmware.com>  writes:
>> This is a fairly general issue, actually. Looking around, I can see at
>> least two similar cases in existing code, with BasicOpenFile, where we
>> will leak file descriptors on error:
>
> Um, don't we automatically clean those up during transaction abort?

Not the ones allocated with PathNameOpenFile or BasicOpenFile. Files 
allocated with AllocateFile() and OpenTemporaryFile() are cleaned up at 
abort.

> If we don't, we ought to think about that, not about cluttering calling
> code with certain-to-be-inadequate cleanup in error cases.

Agreed. Cleaning up at end-of-xact won't help walsender or other 
non-backend processes, though, because they don't do transactions. But a 
top-level ResourceOwner that's reset in the sigsetjmp() cleanup routine 
would work.

- Heikki