pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Munro <tmunro@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Restore pg_pread and friends.
Date: Thu, 29 Sep 2022 00:34:04 +0000
Message-ID: <E1odhV5-0003uA-Ms@gemulon.postgresql.org> (raw)

Restore pg_pread and friends.

Commits cf112c12 and a0dc8271 were a little too hasty in getting rid of
the pg_ prefixes where we use pread(), pwrite() and vectored variants.

We dropped support for ancient Unixes where we needed to use lseek() to
implement replacements for those, but it turns out that Windows also
changes the current position even when you pass in an offset to
ReadFile() and WriteFile() if the file handle is synchronous, despite
its documentation saying otherwise.

Switching to asynchronous file handles would fix that, but have other
complications.  For now let's just put back the pg_ prefix and add some
comments to highlight the non-standard side-effect, which we can now
describe as Windows-only.

Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Discussion: https://postgr.es/m/20220923202439.GA1156054%40nathanxps13

Branch
------
master

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

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c |  4 +-
src/backend/access/heap/rewriteheap.c           |  2 +-
src/backend/access/transam/slru.c               |  4 +-
src/backend/access/transam/xlog.c               |  4 +-
src/backend/access/transam/xlogreader.c         |  2 +-
src/backend/access/transam/xlogrecovery.c       |  2 +-
src/backend/backup/basebackup.c                 |  2 +-
src/backend/replication/walreceiver.c           |  2 +-
src/backend/storage/file/fd.c                   |  8 ++--
src/backend/utils/init/miscinit.c               |  2 +-
src/bin/pg_test_fsync/pg_test_fsync.c           | 50 ++++++++++++-------------
src/include/access/xlogreader.h                 |  4 +-
src/include/port.h                              |  9 +++++
src/include/port/pg_iovec.h                     | 17 +++++++--
src/include/port/win32_port.h                   |  4 +-
src/port/preadv.c                               |  4 +-
src/port/pwritev.c                              |  4 +-
src/port/win32pread.c                           |  3 +-
src/port/win32pwrite.c                          |  3 +-
19 files changed, 75 insertions(+), 55 deletions(-)



Message-ID: <E1odhV5-0003uA-Ms@gemulon.postgresql.org>
Permalink:  ../E1odhV5-0003uA-Ms@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1odhV5-0003uA-Ms@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: tmunro@postgresql.org
  Subject: Re: pgsql: Restore pg_pread and friends.
  In-Reply-To: <E1odhV5-0003uA-Ms@gemulon.postgresql.org>
  References: <E1odhV5-0003uA-Ms@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