pgsql: Revise pg_pwrite_zeros()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Revise pg_pwrite_zeros()
Date: 2023-03-06 04:21:53
Message-ID: E1pZ2MD-0028J0-2W@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Revise pg_pwrite_zeros()

The following changes are made to pg_write_zeros(), the API able to
write series of zeros using vectored I/O:
- Add of an "offset" parameter, to write the size from this position
(the 'p' of "pwrite" seems to mean position, though POSIX does not
outline ythat directly), hence the name of the routine is incorrect if
it is not able to handle offsets.
- Avoid memset() of "zbuffer" on every call.
- Avoid initialization of the whole IOV array if not needed.
- Group the trailing write() call with the main write() call,
simplifying the function logic.

Author: Andres Freund
Reviewed-by: Michael Paquier, Bharath Rupireddy
Discussion: https://postgr.es/m/20230215005525.mrrlmqrxzjzhaipl@awork3.anarazel.de

Branch
------
master

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

Modified Files
--------------
src/backend/access/transam/xlog.c | 2 +-
src/bin/pg_basebackup/walmethods.c | 2 +-
src/common/file_utils.c | 62 +++++++++++++-------------------------
src/include/common/file_utils.h | 2 +-
4 files changed, 24 insertions(+), 44 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2023-03-06 04:50:03 pgsql: Deduplicate handling of binary and text modes in logicalrep_read
Previous Message Thomas Munro 2023-03-06 03:50:34 pgsql: Fix assert failures in parallel SERIALIZABLE READ ONLY.