]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Don't try to read a multi-GB pg_stat_statements file in one call.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 31 Oct 2021 23:13:48 +0000 (19:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 31 Oct 2021 23:13:48 +0000 (19:13 -0400)
commit7104e0b2457d1dc2d0e1c97e5053706e64a0fc50
treed6875ead1130ac0c040827904f55e5b0f49c0be3
parent8424dfced790a5c2886ac33f9ce33eb57bf99f09
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
contrib/pg_stat_statements/pg_stat_statements.c