pgsql: Fix running out of file descriptors for spill files.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix running out of file descriptors for spill files.
Date: 2020-01-02 07:25:41
Message-ID: E1imurV-0000Kf-Ft@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix running out of file descriptors for spill files.

Currently while decoding changes, if the number of changes exceeds a
certain threshold, we spill those to disk.  And this happens for each
(sub)transaction.  Now, while reading all these files, we don't close them
until we read all the files.  While reading these files, if the number of
such files exceeds the maximum number of file descriptors, the operation
errors out.

Use PathNameOpenFile interface to open these files as that internally has
the mechanism to release kernel FDs as needed to get us under the
max_safe_fds limit.

Reported-by: Amit Khandekar
Author: Amit Khandekar
Reviewed-by: Amit Kapila
Backpatch-through: 9.4
Discussion: https://postgr.es/m/CAJ3gD9c-sECEn79zXw4yBnBdOttacoE-6gAyP0oy60nfs_sabQ@mail.gmail.com

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1ad47e8757bb95058e70fd00d5e619833c83df40

Modified Files
--------------
src/backend/replication/logical/reorderbuffer.c | 40 +++++++++++++++----------
1 file changed, 25 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2020-01-02 14:08:03 pgsql: Fix comment in test
Previous Message Peter Geoghegan 2020-01-02 01:30:23 pgsql: Revise BTP_HAS_GARBAGE nbtree VACUUM comments.