pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't try to read a multi-GB pg_stat_statements file in one call
Date: Sun, 31 Oct 2021 23:14:12 +0000
Message-ID: <E1mhK1k-0002lr-Ev@gemulon.postgresql.org> (raw)

Don't try to read a multi-GB pg_stat_statements file in one call.

Windows fails on a request to read() more than INT_MAX bytes,
and perhaps other platforms could have similar issues.  Let's
adjust this code to read at most 1GB per call.

(One would not have thought the file could get that big, but now
we have a field report of trouble, so it can.  We likely ought to
add some mechanism to limit the size of the query-texts file
separately from the size of the hash table.  That is not this
patch, though.)

Per bug #17254 from Yusuke Egashira.  It's been like this for
awhile, so back-patch to all supported branches.

Discussion: https://postgr.es/m/17254-a926c89dc03375c2@postgresql.org

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fdb60ca83d030e77f1e0db4646954d9eb8492ee4

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c | 45 ++++++++++++++++---------
1 file changed, 29 insertions(+), 16 deletions(-)



view thread (7+ messages)

Message-ID: <E1mhK1k-0002lr-Ev@gemulon.postgresql.org>
Permalink:  ../E1mhK1k-0002lr-Ev@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mhK1k-0002lr-Ev@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Don't try to read a multi-GB pg_stat_statements file in one call
  In-Reply-To: <E1mhK1k-0002lr-Ev@gemulon.postgresql.org>
  References: <E1mhK1k-0002lr-Ev@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox