pgsql: Restore pg_pread and friends. - Mailing list pgsql-committers

From Thomas Munro
Subject pgsql: Restore pg_pread and friends.
Date
Msg-id E1odhV5-0003uA-Ms@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: David Rowley
Date:
Subject: pgsql: Restrict Datum sort optimization to byval types only
Next
From: Michael Paquier
Date:
Subject: pgsql: Map ERROR_INVALID_NAME to ENOENT in mapping table of win32error.