Re: [HACKERS] OpenTemporaryFile() vs resowner.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] OpenTemporaryFile() vs resowner.c
Date
Msg-id 19645.1510178084@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] OpenTemporaryFile() vs resowner.c  (Thomas Munro <thomas.munro@enterprisedb.com>)
List pgsql-hackers
Thomas Munro <thomas.munro@enterprisedb.com> writes:
> Andres, Robert and Peter G rightly complained[1] that my shared
> temporary file patch opens a file, then calls
> ResourceOwnerEnlargeFiles() which can fail due to lack of memory, and
> then registers the file handle to make sure we don't leak it.  Doh.
> The whole point of the separate ResourceOwnerEnlargeXXX() interface is
> to be able to put it before resource acquisition.

> The existing OpenTemporaryFile() coding has the same mistake.  Please
> see attached.

Pushed.  I grepped for related problems and found that IncrBufferRefCount
was also living dangerously, though in a different way: it remembered
a refcount it hadn't actually applied yet.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: [HACKERS] Pg V10: Patch for bug in bonjour support
Next
From: Lucas B
Date:
Subject: Re: [HACKERS] Early locking option to parallel backup