pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add BufFileRead variants with short read and EOF detection
Date: Mon, 16 Jan 2023 10:15:55 +0000
Message-ID: <E1pHMWx-003wZp-I8@gemulon.postgresql.org> (raw)

Add BufFileRead variants with short read and EOF detection

Most callers of BufFileRead() want to check whether they read the full
specified length.  Checking this at every call site is very tedious.
This patch provides additional variants BufFileReadExact() and
BufFileReadMaybeEOF() that include the length checks.

I considered changing BufFileRead() itself, but this function is also
used in extensions, and so changing the behavior like this would
create a lot of problems there.  The new names are analogous to the
existing LogicalTapeReadExact().

Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f3501945-c591-8cc3-5ef0-b72a2e0eaa9c@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/20428d344a2964de6aaef9984fcd472f3c65d115

Modified Files
--------------
src/backend/access/gist/gistbuildbuffers.c |  7 +----
src/backend/backup/backup_manifest.c       |  9 +-----
src/backend/executor/nodeHashjoin.c        | 18 +++--------
src/backend/replication/logical/worker.c   | 32 +++----------------
src/backend/storage/file/buffile.c         | 50 ++++++++++++++++++++++++++++--
src/backend/utils/sort/logtape.c           |  9 +-----
src/backend/utils/sort/sharedtuplestore.c  | 49 ++++-------------------------
src/backend/utils/sort/tuplestore.c        | 29 ++++-------------
src/include/storage/buffile.h              |  4 ++-
9 files changed, 73 insertions(+), 134 deletions(-)



Message-ID: <E1pHMWx-003wZp-I8@gemulon.postgresql.org>
Permalink:  ../E1pHMWx-003wZp-I8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pHMWx-003wZp-I8@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: peter@eisentraut.org
  Subject: Re: pgsql: Add BufFileRead variants with short read and EOF detection
  In-Reply-To: <E1pHMWx-003wZp-I8@gemulon.postgresql.org>
  References: <E1pHMWx-003wZp-I8@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