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: Rework error messages around file handling
Date: Tue, 17 Jul 2018 23:05:32 +0000
Message-ID: <E1ffZ2C-0003jE-Ln@gemulon.postgresql.org> (raw)

Rework error messages around file handling

Some error messages related to file handling are using the code path
context to define their state.  For example, 2PC-related errors are
referring to "two-phase status files", or "relation mapping file" is
used for catalog-to-filenode mapping, however those prove to be
difficult to translate, and are not more helpful than just referring to
the path of the file being worked on.  So simplify all those error
messages by just referring to files with their path used.  In some
cases, like the manipulation of WAL segments, the context is actually
helpful so those are kept.

Calls to the system function read() have also been rather inconsistent
with their error handling sometimes not reporting the number of bytes
read, and some other code paths trying to use an errno which has not
been set.  The in-core functions are using a more consistent pattern
with this patch, which checks for both errno if set or if an
inconsistent read is happening.

So as to care about pluralization when reading an unexpected number of
byte(s), "could not read: read %d of %zu" is used as error message, with
%d field being the output result of read() and %zu the expected size.
This simplifies the work of translators with less variations of the same
message.

Author: Michael Paquier
Reviewed-by: Álvaro Herrera
Discussion: https://postgr.es/m/20180520000522.GB1603@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/811b6e36a9e21a4d9eb78410976c88ce601cea0c

Modified Files
--------------
src/backend/access/transam/twophase.c       | 40 +++++++++--------
src/backend/access/transam/xlog.c           | 40 +++++++++++------
src/backend/replication/logical/origin.c    | 13 ++++--
src/backend/replication/logical/snapbuild.c | 68 ++++++++++++++++++++---------
src/backend/replication/slot.c              | 26 +++++++----
src/backend/replication/walsender.c         | 20 +++++++--
src/backend/utils/cache/relmapper.c         | 28 +++++++-----
src/bin/pg_basebackup/pg_receivewal.c       | 12 +++--
src/bin/pg_rewind/file_ops.c                | 14 ++++--
src/bin/pg_rewind/parsexlog.c               | 14 ++++--
src/bin/pg_waldump/pg_waldump.c             | 19 +++++---
src/common/controldata_utils.c              |  8 ++--
12 files changed, 207 insertions(+), 95 deletions(-)



view thread (8+ messages)  latest in thread

Message-ID: <E1ffZ2C-0003jE-Ln@gemulon.postgresql.org>
Permalink:  ../E1ffZ2C-0003jE-Ln@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ffZ2C-0003jE-Ln@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: michael@paquier.xyz
  Subject: Re: pgsql: Rework error messages around file handling
  In-Reply-To: <E1ffZ2C-0003jE-Ln@gemulon.postgresql.org>
  References: <E1ffZ2C-0003jE-Ln@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