pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Address set of issues with errno handling
Date: Mon, 25 Jun 2018 02:23:59 +0000
Message-ID: <E1fXHAd-0004Qv-8y@gemulon.postgresql.org> (raw)

Address set of issues with errno handling

System calls mixed up in error code paths are causing two issues which
several code paths have not correctly handled:
1) For write() calls, sometimes the system may return less bytes than
what has been written without errno being set.  Some paths were careful
enough to consider that case, and assumed that errno should be set to
ENOSPC, other calls missed that.
2) errno generated by a system call is overwritten by other system calls
which may succeed once an error code path is taken, causing what is
reported to the user to be incorrect.

This patch uses the brute-force approach of correcting all those code
paths.  Some refactoring could happen in the future, but this is let as
future work, which is not targeted for back-branches anyway.

Author: Michael Paquier
Reviewed-by: Ashutosh Sharma
Discussion: https://postgr.es/m/20180622061535.GD5215@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6cb3372411fd6ed8ba0f8d36ae578a2daa517c16

Modified Files
--------------
src/backend/access/heap/rewriteheap.c           |  5 ++++
src/backend/access/transam/twophase.c           | 23 +++++++++++++++++
src/backend/access/transam/xlog.c               |  7 +++++
src/backend/access/transam/xlogutils.c          |  6 +++--
src/backend/replication/basebackup.c            |  3 +++
src/backend/replication/logical/origin.c        | 15 +++++++++++
src/backend/replication/logical/reorderbuffer.c |  4 ++-
src/backend/replication/logical/snapbuild.c     | 20 +++++++++++++++
src/backend/replication/slot.c                  |  7 ++++-
src/bin/pg_basebackup/walmethods.c              | 34 +++++++++++++++++++++++--
10 files changed, 118 insertions(+), 6 deletions(-)



view thread (11+ messages)  latest in thread

Message-ID: <E1fXHAd-0004Qv-8y@gemulon.postgresql.org>
Permalink:  ../E1fXHAd-0004Qv-8y@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fXHAd-0004Qv-8y@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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Address set of issues with errno handling
  In-Reply-To: <E1fXHAd-0004Qv-8y@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